Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: src/source-position-table.cc

Issue 2525663003: Prevent read-after-buffer in SourcePositionTableIterator::Advance. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/source-position-table.h" 5 #include "src/source-position-table.h"
6 6
7 #include "src/log.h" 7 #include "src/log.h"
8 #include "src/objects-inl.h" 8 #include "src/objects-inl.h"
9 #include "src/objects.h" 9 #include "src/objects.h"
10 10
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 } 168 }
169 169
170 SourcePositionTableIterator::SourcePositionTableIterator(ByteArray* byte_array) 170 SourcePositionTableIterator::SourcePositionTableIterator(ByteArray* byte_array)
171 : table_(byte_array), index_(0), current_() { 171 : table_(byte_array), index_(0), current_() {
172 Advance(); 172 Advance();
173 } 173 }
174 174
175 void SourcePositionTableIterator::Advance() { 175 void SourcePositionTableIterator::Advance() {
176 DCHECK(!done()); 176 DCHECK(!done());
177 DCHECK(index_ >= 0 && index_ <= table_->length()); 177 DCHECK(index_ >= 0 && index_ <= table_->length());
178 if (index_ == table_->length()) { 178 if (index_ >= table_->length()) {
179 index_ = kDone; 179 index_ = kDone;
180 } else { 180 } else {
181 PositionTableEntry tmp; 181 PositionTableEntry tmp;
182 DecodeEntry(table_, &index_, &tmp); 182 DecodeEntry(table_, &index_, &tmp);
183 AddAndSetEntry(current_, tmp); 183 AddAndSetEntry(current_, tmp);
184 } 184 }
185 } 185 }
186 186
187 } // namespace internal 187 } // namespace internal
188 } // namespace v8 188 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698