Bug 187246 - String buffer is reallocated in FileSystem::fileSystemRepresentation.
Summary: String buffer is reallocated in FileSystem::fileSystemRepresentation.
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Per Arne Vollan
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-02 07:19 PDT by Per Arne Vollan
Modified: 2018-07-03 07:44 PDT (History)
1 user (show)

See Also:


Attachments
Patch (2.51 KB, patch)
2018-07-02 07:24 PDT, Per Arne Vollan
ap: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Per Arne Vollan 2018-07-02 07:19:13 PDT
The length of the new string buffer is computed by CFStringGetMaximumSizeOfFileSystemRepresentation, which over-estimates the required length. To save space, the string buffer is currently reallocated before returning the string. Since the returned string is never stored by any callers as far as I can see, reallocating is not necessary. The caller can reallocate the buffer if the string is going to be stored.
Comment 1 Per Arne Vollan 2018-07-02 07:24:19 PDT
Created attachment 344100 [details]
Patch
Comment 2 Alexey Proskuryakov 2018-07-03 02:26:30 PDT
Comment on attachment 344100 [details]
Patch

svn blame points to http://trac.webkit.org/r149531, which explains why this is necessary.
Comment 3 Per Arne Vollan 2018-07-03 07:44:58 PDT
(In reply to Alexey Proskuryakov from comment #2)
> Comment on attachment 344100 [details]
> Patch
> 
> svn blame points to http://trac.webkit.org/r149531, which explains why this
> is necessary.

Ah, I see. Thanks for reviewing!