Bug 186758

Summary: Correctly close the variable argument list
Product: WebKit Reporter: Tomas Popela <tpopela>
Component: Web Template FrameworkAssignee: Tomas Popela <tpopela>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, cdumez, cmarcelo, dbates, ews-watchlist, Hironori.Fujii, mcatanzaro, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Archive of layout-test-results from ews200 for win-future
none
Patch
none
Archive of layout-test-results from ews200 for win-future none

Description Tomas Popela 2018-06-18 04:18:03 PDT
Found by Coverity scan:

1. webkitgtk-2.20.3/Source/WTF/wtf/text/WTFString.cpp:454: va_init: Initializing va_list "argsCopy".
3. webkitgtk-2.20.3/Source/WTF/wtf/text/WTFString.cpp:480: missing_va_end: va_end was not called for "argsCopy".
#   478|   
#   479|       if (result == 0)
#   480|->         return emptyString();
#   481|       if (result < 0)
#   482|           return String();
Comment 1 Tomas Popela 2018-06-18 04:20:28 PDT
Created attachment 342925 [details]
Patch
Comment 2 EWS Watchlist 2018-06-18 04:23:45 PDT
Attachment 342925 [details] did not pass style-queue:


ERROR: Source/WTF/wtf/text/WTFString.cpp:480:  Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons.  [readability/comparison_to_zero] [5]
Total errors found: 1 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 EWS Watchlist 2018-06-18 15:52:33 PDT
Comment on attachment 342925 [details]
Patch

Attachment 342925 [details] did not pass win-ews (win):
Output: http://webkit-queues.webkit.org/results/8236949

New failing tests:
http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-audio.html
Comment 4 EWS Watchlist 2018-06-18 15:52:44 PDT
Created attachment 342984 [details]
Archive of layout-test-results from ews200 for win-future

The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews200  Port: win-future  Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
Comment 6 Michael Catanzaro 2018-06-30 14:30:02 PDT
Comment on attachment 342925 [details]
Patch

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

> Source/WTF/wtf/text/WTFString.cpp:466
>          va_end(args);
> +        va_end(argsCopy);

Good catch, Fujii. Surely this function should call va_end(argsCopy), as Coverity suggests, but it should NOT call va_end(args).

> Source/WTF/wtf/text/WTFString.cpp:478
>      va_end(args);

This should be removed, as well.
Comment 7 Tomas Popela 2018-07-24 04:21:14 PDT
(In reply to Fujii Hironori from comment #5) 
> Why does createWithFormatAndArguments invoke va_end(args)?

Good catch Fujii!

Also String::formatWithArguments() is not used at all. I will open a bug for removing it.
Comment 8 Tomas Popela 2018-07-24 04:23:38 PDT
Created attachment 345657 [details]
Patch
Comment 9 EWS Watchlist 2018-07-24 11:30:12 PDT
Comment on attachment 345657 [details]
Patch

Attachment 345657 [details] did not pass win-ews (win):
Output: https://webkit-queues.webkit.org/results/8639639

New failing tests:
http/tests/security/canvas-remote-read-remote-video-localhost.html
Comment 10 EWS Watchlist 2018-07-24 11:30:23 PDT
Created attachment 345695 [details]
Archive of layout-test-results from ews200 for win-future

The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews200  Port: win-future  Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
Comment 11 Tomas Popela 2018-07-25 00:11:42 PDT
Comment on attachment 345657 [details]
Patch

Clearing flags on attachment: 345657

Committed r234192: <https://trac.webkit.org/changeset/234192>
Comment 12 Tomas Popela 2018-07-25 00:11:47 PDT
All reviewed patches have been landed.  Closing bug.
Comment 13 Radar WebKit Bug Importer 2018-07-25 00:14:04 PDT
<rdar://problem/42572181>