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

Unified Diff: vm/os_win.cc

Issue 10696165: Don't allow OS::SNPrint or OS::VSNPrint to return negative values. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « vm/os_test.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/os_win.cc
===================================================================
--- vm/os_win.cc (revision 9556)
+++ vm/os_win.cc (working copy)
@@ -155,7 +155,11 @@
int OS::VSNPrint(char* str, size_t size, const char* format, va_list args) {
if (str == NULL || size == 0) {
- return _vscprintf(format, args);
+ int retval = _vscprintf(format, args);
+ if (retval < 0) {
+ FATAL1("Fatal error in OS::VSNPrint with format '%s'", format);
+ }
+ return retval;
}
va_list args_copy;
va_copy(args_copy, args);
@@ -168,6 +172,9 @@
va_list args_retry;
va_copy(args_retry, args);
written = _vscprintf(format, args_retry);
+ if (written < 0) {
+ FATAL1("Fatal error in OS::VSNPrint with format '%s'", format);
+ }
va_end(args_retry);
}
// Make sure to zero-terminate the string if the output was
« no previous file with comments | « vm/os_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698