Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: d2b96acf830aabd2416fc1a356f495600cfadef6
https://github.com/WebKit/WebKit/commit/d2b96acf830aabd2416fc1a356f495600cfadef6
Author: Adrian Perez de Castro <[email protected]>
Date: 2025-12-13 (Sat, 13 Dec 2025)
Changed paths:
M Source/JavaScriptCore/API/glib/JSCValue.cpp
M Source/WTF/wtf/glib/GSpanExtras.h
Log Message:
-----------
[GLib] Reduce use of WTF_ALLOW_UNSAFE_BUFFER_USAGE in JSCValue.cpp
https://bugs.webkit.org/show_bug.cgi?id=304090
Reviewed by Carlos Garcia Campos.
Remove most uses of WTF_ALLOW_UNSAFE_BUFFER_USAGE_{BEGIN,END}. There are
three left: two instances are around uses of G_VALUE_COLLECT_INIT(), a macro
defined by GLib, which we can assume are correct; the other one from adding
the offset to the base pointer of a TypedArray to return the actual pointer
to the data it references. The latter could be probably changed, but does
not seem worth it given that the code is dealing with values internal to
JSC which are expected to be valid at this point.
* Source/JavaScriptCore/API/glib/JSCValue.cpp:
(jsc_value_new_string_from_bytes): Use the span(GBytes*) helper to avoid
having to manually go through span creation for the String::fromUTF8() call.
(jsc_value_new_array_from_strv): Add the new span() helper that takes a const
GStrv, switch iteration avoid indices.
(jsc_value_object_enumerate_properties): Use GMallocSpan to allocate the
memory for the result values; while at it use checked arithmetic to detect
overflows when calculating the size of the result array.
(jsc_value_object_invoke_methodv): Use a span to iterate over the
function parameters.
(jsc_value_new_functionv): Use a span to provide provide the values of
the Vector used for the function parameter types.
(jsc_value_function_callv): Use a span to iterate over the function
parameters.
(jsc_value_constructor_callv):
* Source/WTF/wtf/glib/GSpanExtras.h:
(WTF::span): Added helper that takes a const GStrv.
Canonical link: https://commits.webkit.org/304419@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications