Make StringExtras.h versions of snprintf and vsnprintf match the unix versions. MSVC does not ensure the buffers are null terminated as the unix versions do.
Created attachment 60424 [details] Patch
Comment on attachment 60424 [details] Patch > + // In the case where the string entirely filled the buffer, _vsnprintf will not > + // null-terminate it, but vsnprintf must. > + if (count > 0) > + buffer[count - 1] = '\0'; But what about the case where Windows *does* have vsnprintf, but it has the wrong behavior and does not terminate the buffer with a nul character? As I understand it, this is the case with MSVC 8 and newer!
Created attachment 60426 [details] Updated patch
Attachment 60426 [details] did not pass style-queue: Failed to run "['WebKitTools/Scripts/check-webkit-style', '--no-squash']" exit_code: 1 JavaScriptCore/wtf/StringExtras.h:56: wtf_vsnprintf is incorrectly named. Don't use underscores in your identifier names. [readability/naming] [4] Total errors found: 1 in 4 files If any of these errors are false positives, please file a bug against check-webkit-style.
Attachment 60426 [details] did not build on win: Build output: http://webkit-commit-queue.appspot.com/results/3399146
Comment on attachment 60426 [details] Updated patch > +// Work around a bug in Microsoft's implementation of vsnprintf, where > +// vsnprintf does not null terminate the buffer > +#define vsnprintf(x, y) wtf_vsnprintf(x, y) vsnprintf has 4 arguments, not 2, which is presumably why the bot is failing to build
Created attachment 60457 [details] Patch 3
Attachment 60457 [details] did not pass style-queue: Failed to run "['WebKitTools/Scripts/check-webkit-style', '--no-squash']" exit_code: 1 JavaScriptCore/wtf/StringExtras.h:56: wtf_vsnprintf is incorrectly named. Don't use underscores in your identifier names. [readability/naming] [4] Total errors found: 1 in 4 files If any of these errors are false positives, please file a bug against check-webkit-style.
Landed in r62457.