Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 98b041523464c50009ef773d070146db9f6084c0
      
https://github.com/WebKit/WebKit/commit/98b041523464c50009ef773d070146db9f6084c0
  Author: Carlos Bentzen <[email protected]>
  Date:   2024-07-04 (Thu, 04 Jul 2024)

  Changed paths:
    M Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.h
    M Tools/TestWebKitAPI/Tests/WebCore/gstreamer/GStreamerTest.cpp

  Log Message:
  -----------
  [GStreamer] gstStructureGet<T> may return optionals with unitialized values 
on Clang 18
https://bugs.webkit.org/show_bug.cgi?id=276224

Reviewed by Philippe Normand.

We found an issue that is triggered by a compiler bug. The bug has been
reproduced with Clang 18 and libstdc++ 13.2 so far, and has been reduced
outside of WebKit at https://github.com/cadubentzen/std-optional-bug-clang.

In the context of WebKit + GStreamer, it's triggered as below, where
we hit the assertion:

auto structure = gst_structure_from_string("a-structure, width=10", NULL);
auto height = gstStructureGet<int>(structure, "height"_s);
if (height && *height > 0) {
    useHeightValue(*height);
    ASSERT_NOT_REACHED();
}

The bug is fixed by using UNLIKELY in the branches of gstStructureGet<T>.

A test has also been added to avoid regressing this.

* Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.h:
(WebCore::gstStructureGet):
* Tools/TestWebKitAPI/Tests/WebCore/gstreamer/GStreamerTest.cpp:
(TestWebKitAPI::TEST_F):

Canonical link: https://commits.webkit.org/280669@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to