WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
276224
[GStreamer] gstStructureGet<T> may return optionals with unitialized values on Clang 18
https://bugs.webkit.org/show_bug.cgi?id=276224
Summary
[GStreamer] gstStructureGet<T> may return optionals with unitialized values o...
Carlos Bentzen
Reported
2024-07-04 06:55:39 PDT
On
bug 275609
we introduced the gstStructureGet<T> helper. After using it in more places, we found what may be a compiler bug (reproduced it with Clang 18 so far). Given a GstStructure named structure with "a-structure, width=10". If we try: auto height = gstStructureGet<int>(structure, "height"_s); if (height) GST_LOG("height = %d", *height); although the branch shouldn't be executed since there's no "height" field. It is executed with an unitialized value. After debugging what's happening, it seems to be actually a compiler issue. Fixed it by using if(UNLIKELY(gst_structure_get_<type>)) in gstStructureGet branches. Without that, the branches were being executed and returning std::optional with unitialized values when they shouldn't. Patch for the fix in WebKit incoming. Pending on a minimal reproducer outside WebKit to confirm it's a bug in Clang...
Attachments
Add attachment
proposed patch, testcase, etc.
Philippe Normand
Comment 1
2024-07-04 07:27:32 PDT
***
Bug 276222
has been marked as a duplicate of this bug. ***
Carlos Bentzen
Comment 2
2024-07-04 08:54:02 PDT
Reduced the copmpiler bug outside of WebKit at
https://github.com/cadubentzen/std-optional-bug-clang
Carlos Bentzen
Comment 3
2024-07-04 09:32:12 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/30493
EWS
Comment 4
2024-07-04 11:53:24 PDT
Committed
280669@main
(98b041523464): <
https://commits.webkit.org/280669@main
> Reviewed commits have been landed. Closing PR #30493 and removing active labels.
Radar WebKit Bug Importer
Comment 5
2024-07-04 11:54:14 PDT
<
rdar://problem/131130985
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug