Bug 191888 - [SOUP] Certificate decoder always returns GByteArray with zero size
Summary: [SOUP] Certificate decoder always returns GByteArray with zero size
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Adrian Perez
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-11-21 07:56 PST by Adrian Perez
Modified: 2018-11-21 08:38 PST (History)
12 users (show)

See Also:


Attachments
Patch (1.55 KB, patch)
2018-11-21 07:59 PST, Adrian Perez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Perez 2018-11-21 07:56:07 PST
[SOUP] Certificate decoder always returns GByteArray with zero size
Comment 1 Adrian Perez 2018-11-21 07:59:24 PST
Created attachment 355413 [details]
Patch
Comment 2 Zan Dobersek 2018-11-21 08:11:23 PST
Comment on attachment 355413 [details]
Patch

Can you check other similar cases (i.e. g_byte_array_sized_new() calls without the subsequent g_byte_array_set_size() call), if any?
Comment 3 Claudio Saavedra 2018-11-21 08:13:17 PST
(In reply to Zan Dobersek from comment #2)
> Comment on attachment 355413 [details]
> Patch
> 
> Can you check other similar cases (i.e. g_byte_array_sized_new() calls
> without the subsequent g_byte_array_set_size() call), if any?

This is only needed here because we're writing directly to the array->bytes instead of calling g_byte_array_append(), which saves us one allocation, but has this drawback.
Comment 4 Adrian Perez 2018-11-21 08:13:34 PST
(In reply to Zan Dobersek from comment #2)
> Comment on attachment 355413 [details]
> Patch
> 
> Can you check other similar cases (i.e. g_byte_array_sized_new() calls
> without the subsequent g_byte_array_set_size() call), if any?

Sure, I'll take a look and if needed (hopefully not!) then add new
bug reports for them :)
Comment 5 Adrian Perez 2018-11-21 08:17:36 PST
(In reply to Adrian Perez from comment #4)
> (In reply to Zan Dobersek from comment #2)
> > Comment on attachment 355413 [details]
> > Patch
> > 
> > Can you check other similar cases (i.e. g_byte_array_sized_new() calls
> > without the subsequent g_byte_array_set_size() call), if any?
> 
> Sure, I'll take a look and if needed (hopefully not!) then add new
> bug reports for them :)

The only other use of “g_byte_array_sized_new()” is in 
“WebKit/Shared/soup/WebCoreArgumentCodersSoup.cpp” (line 103),
and in that case is followed by a call to “g_byte_array_append()”
instead 👍
Comment 6 WebKit Commit Bot 2018-11-21 08:37:36 PST
Comment on attachment 355413 [details]
Patch

Clearing flags on attachment: 355413

Committed r238417: <https://trac.webkit.org/changeset/238417>
Comment 7 WebKit Commit Bot 2018-11-21 08:37:38 PST
All reviewed patches have been landed.  Closing bug.
Comment 8 Radar WebKit Bug Importer 2018-11-21 08:38:25 PST
<rdar://problem/46201982>