Bug 140938 - Refactor the code to handle missing va_end() call after va_start() in String::format
Summary: Refactor the code to handle missing va_end() call after va_start() in String:...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-27 07:00 PST by Santosh Mahto
Modified: 2015-01-29 11:49 PST (History)
4 users (show)

See Also:


Attachments
Patch (1.75 KB, patch)
2015-01-27 07:29 PST, Santosh Mahto
no flags Details | Formatted Diff | Diff
Patch (1.94 KB, patch)
2015-01-28 07:07 PST, Santosh Mahto
no flags Details | Formatted Diff | Diff
Patch for landing (2.14 KB, patch)
2015-01-29 10:52 PST, Santosh Mahto
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Santosh Mahto 2015-01-27 07:00:34 PST
In WTFString.cpp  WTF::String::format(), va_end call could be missed after va_start() is called if the function return
at following places.

if (result == 0)
     return String("");
if (result < 0)
    return String();
Comment 1 Santosh Mahto 2015-01-27 07:29:00 PST
Created attachment 245445 [details]
Patch
Comment 2 Alexey Proskuryakov 2015-01-27 17:03:35 PST
Comment on attachment 245445 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=245445&action=review

> Source/WTF/wtf/text/WTFString.cpp:469
>      // Not calling va_end/va_start here happens to work on lots of
>      // systems, but fails e.g. on 64bit Linux.

The patch looks good to me, but it needs to remove the orphaned comment.
Comment 3 Santosh Mahto 2015-01-28 07:07:56 PST
Created attachment 245539 [details]
Patch
Comment 4 Santosh Mahto 2015-01-28 07:09:30 PST
(In reply to comment #2)
> Comment on attachment 245445 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=245445&action=review
> 
> > Source/WTF/wtf/text/WTFString.cpp:469
> >      // Not calling va_end/va_start here happens to work on lots of
> >      // systems, but fails e.g. on 64bit Linux.
> 
> The patch looks good to me, but it needs to remove the orphaned comment.

Thanks for review. please review the next update incorporating your suggestion.
Comment 5 Alexey Proskuryakov 2015-01-28 09:43:04 PST
Comment on attachment 245539 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=245539&action=review

> Source/WTF/ChangeLog:8
> +        Moved va_start/va_end call to match  seperately.

The correct spelling is "separately". Also, not sure if this comment adds anything of value on top of the title.

Is there any known benefit, other than the code looking slightly more nicely (e.g. does that fix some platform)? It would be good to explain that in the bug for posterity if so.
Comment 6 Santosh Mahto 2015-01-29 10:52:35 PST
Created attachment 245631 [details]
Patch for landing
Comment 7 Santosh Mahto 2015-01-29 11:11:36 PST
(In reply to comment #5)
> Comment on attachment 245539 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=245539&action=review
> 
> > Source/WTF/ChangeLog:8
> > +        Moved va_start/va_end call to match  seperately.
> 
> The correct spelling is "separately". Also, not sure if this comment adds
> anything of value on top of the title.
> 
> Is there any known benefit, other than the code looking slightly more nicely
> (e.g. does that fix some platform)? It would be good to explain that in the
> bug for posterity if s

I updated the comment section.may be it make sense now a bit. sending it to land
Comment 8 WebKit Commit Bot 2015-01-29 11:49:20 PST
Comment on attachment 245631 [details]
Patch for landing

Clearing flags on attachment: 245631

Committed r179354: <http://trac.webkit.org/changeset/179354>
Comment 9 WebKit Commit Bot 2015-01-29 11:49:26 PST
All reviewed patches have been landed.  Closing bug.