WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
41553
Make StringExtras.h versions of snprintf and vsnprintf match the unix versions
https://bugs.webkit.org/show_bug.cgi?id=41553
Summary
Make StringExtras.h versions of snprintf and vsnprintf match the unix versions
Sam Weinig
Reported
2010-07-02 17:48:00 PDT
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.
Attachments
Patch
(3.80 KB, patch)
2010-07-02 17:50 PDT
,
Sam Weinig
no flags
Details
Formatted Diff
Diff
Updated patch
(4.14 KB, patch)
2010-07-02 18:05 PDT
,
Sam Weinig
no flags
Details
Formatted Diff
Diff
Patch 3
(4.10 KB, patch)
2010-07-03 14:14 PDT
,
Sam Weinig
darin
: review+
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Sam Weinig
Comment 1
2010-07-02 17:50:45 PDT
Created
attachment 60424
[details]
Patch
Darin Adler
Comment 2
2010-07-02 17:53:39 PDT
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!
Sam Weinig
Comment 3
2010-07-02 18:05:24 PDT
Created
attachment 60426
[details]
Updated patch
WebKit Review Bot
Comment 4
2010-07-02 18:06:41 PDT
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.
WebKit Review Bot
Comment 5
2010-07-03 03:16:38 PDT
Attachment 60426
[details]
did not build on win: Build output:
http://webkit-commit-queue.appspot.com/results/3399146
Darin Adler
Comment 6
2010-07-03 10:05:17 PDT
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
Sam Weinig
Comment 7
2010-07-03 14:14:28 PDT
Created
attachment 60457
[details]
Patch 3
WebKit Review Bot
Comment 8
2010-07-03 14:17:29 PDT
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.
Sam Weinig
Comment 9
2010-07-03 17:11:53 PDT
Landed in
r62457
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug