Bug 202154 - Address static analysis warning in ParkingLot.cpp: Access to field 'size' results in a dereference of a null pointer
Summary: Address static analysis warning in ParkingLot.cpp: Access to field 'size' res...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Keith Rollin
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-09-24 12:15 PDT by Keith Rollin
Modified: 2019-09-29 19:21 PDT (History)
10 users (show)

See Also:


Attachments
Patch (2.41 KB, patch)
2019-09-24 12:18 PDT, Keith Rollin
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Keith Rollin 2019-09-24 12:15:57 PDT
Static analysis reports the following:

    .../OpenSource/Source/WTF/wtf/ParkingLot.cpp:376:30: warning: Access to field 'size' results in a dereference of a null pointer (loaded from variable 'oldHashtable')
        RELEASE_ASSERT(newSize > oldHashtable->size);
                                 ^~~~~~~~~~~~~~~~~~

This warning arises because earlier code checks to see if oldHashtable is NULL, leading the static analyzer to think that it *could* be NULL. However, earlier code actually ensures that oldhashtable will not be NULL. Address this by removing the NULL check, and back it up with an ASSERT to ensure that it's not NULL.
Comment 1 Radar WebKit Bug Importer 2019-09-24 12:16:14 PDT
<rdar://problem/55672103>
Comment 2 Keith Rollin 2019-09-24 12:18:09 PDT
Created attachment 379465 [details]
Patch
Comment 3 Brent Fulgham 2019-09-29 15:51:25 PDT
Comment on attachment 379465 [details]
Patch

This seems like a reasonable change.
Comment 4 WebKit Commit Bot 2019-09-29 19:21:55 PDT
Comment on attachment 379465 [details]
Patch

Clearing flags on attachment: 379465

Committed r250497: <https://trac.webkit.org/changeset/250497>
Comment 5 WebKit Commit Bot 2019-09-29 19:21:56 PDT
All reviewed patches have been landed.  Closing bug.