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

Side by Side Diff: src/v8utils.cc

Issue 14018010: Fix OOB write in --print-code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 8 months 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 | Annotate | Revision Log
« no previous file with comments | « src/utils.cc ('k') | test/mjsunit/regress/regress-2624.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 257
258 void StringBuilder::AddFormatted(const char* format, ...) { 258 void StringBuilder::AddFormatted(const char* format, ...) {
259 va_list arguments; 259 va_list arguments;
260 va_start(arguments, format); 260 va_start(arguments, format);
261 AddFormattedList(format, arguments); 261 AddFormattedList(format, arguments);
262 va_end(arguments); 262 va_end(arguments);
263 } 263 }
264 264
265 265
266 void StringBuilder::AddFormattedList(const char* format, va_list list) { 266 void StringBuilder::AddFormattedList(const char* format, va_list list) {
267 ASSERT(!is_finalized() && position_ < buffer_.length()); 267 ASSERT(!is_finalized() && position_ <= buffer_.length());
268 int n = OS::VSNPrintF(buffer_ + position_, format, list); 268 int n = OS::VSNPrintF(buffer_ + position_, format, list);
269 if (n < 0 || n >= (buffer_.length() - position_)) { 269 if (n < 0 || n >= (buffer_.length() - position_)) {
270 position_ = buffer_.length(); 270 position_ = buffer_.length();
271 } else { 271 } else {
272 position_ += n; 272 position_ += n;
273 } 273 }
274 } 274 }
275 275
276 } } // namespace v8::internal 276 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/utils.cc ('k') | test/mjsunit/regress/regress-2624.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698