[Webkit-unassigned] [Bug 283684] New: [WPE][GTK] Fix various -Werror=unsafe-buffer-usage-in-container build failures

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Nov 25 13:41:26 PST 2024


https://bugs.webkit.org/show_bug.cgi?id=283684

            Bug ID: 283684
           Summary: [WPE][GTK] Fix various
                    -Werror=unsafe-buffer-usage-in-container build
                    failures
           Product: WebKit
           Version: Other
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebKitGTK
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: mcatanzaro at redhat.com
                CC: bugs-noreply at webkitgtk.org

[2614/5505] Building CXX object Source/WebCore/CMakeFiles/WebCore.dir/platform/image-decoders/ico/ICOImageDecoder.cpp.o
/home/mcatanzaro/Projects/WebKit/Source/WebCore/platform/image-decoders/ico/ICOImageDecoder.cpp:324:63: warning: the two-parameter std::span construction is unsafe as it can introduce mismatch between buffer size and the bound information [-Wunsafe-buffer-usage-in-container]
  324 |     return equalSpans(m_data->span().subspan(imageOffset, 4), std::span { "\x89PNG", 4 }) ? PNG : BMP;
      |                                                               ^
1 warning generated.
[3333/5505] Building CXX object Source/WebCore/CMakeFiles/WebCore.dir/__/__/WebCore/DerivedSources/unified-sources/UnifiedSource-3c72abbe-23.cpp.o
In file included from /home/mcatanzaro/Projects/WebKit/WebKitBuild/gtk4/WebCore/DerivedSources/unified-sources/UnifiedSource-3c72abbe-23.cpp:3:
/home/mcatanzaro/Projects/WebKit/Source/WebCore/platform/glib/KeyedDecoderGlib.cpp:72:13: warning: the two-parameter std::span construction is unsafe as it can introduce mismatch between buffer size and the bound information [-Wunsafe-buffer-usage-in-container]
   72 |     bytes = { static_cast<const uint8_t*>(g_variant_get_data(value.get())), g_variant_get_size(value.get()) };
      |             ^
In file included from /home/mcatanzaro/Projects/WebKit/WebKitBuild/gtk4/WebCore/DerivedSources/unified-sources/UnifiedSource-3c72abbe-23.cpp:4:
/home/mcatanzaro/Projects/WebKit/Source/WebCore/platform/glib/KeyedEncoderGlib.cpp:140:33: warning: the two-parameter std::span construction is unsafe as it can introduce mismatch between buffer size and the bound information [-Wunsafe-buffer-usage-in-container]
  140 |     return SharedBuffer::create(std::span { static_cast<const unsigned char*>(g_bytes_get_data(data.get(), nullptr)), static_cast<unsigned>(g_bytes_get_size(data.get())) });
      |                                 ^
2 warnings generated.
[3339/5505] Building CXX object Source/WebCore/CMakeFiles/WebCore.dir/__/__/WebCore/DerivedSources/unified-sources/UnifiedSource-3c72abbe-20.cpp.o
In file included from /home/mcatanzaro/Projects/WebKit/WebKitBuild/gtk4/WebCore/DerivedSources/unified-sources/UnifiedSource-3c72abbe-20.cpp:6:
/home/mcatanzaro/Projects/WebKit/Source/WebCore/platform/audio/gstreamer/PlatformRawAudioDataGStreamer.cpp:228:62: warning: the two-parameter std::span construction is unsafe as it can introduce mismatch between buffer size and the bound information [-Wunsafe-buffer-usage-in-container]
  228 |     auto converter = getAudioConvertedForFormat(StringView { std::span { key.get(), strlen(key.get()) } }, *sourceInfo.get(), destinationInfo);
      |                                                              ^
1 warning generated.
[3343/5505] Building CXX object Source/WebCore/CMakeFiles/WebCore.dir/__/__/WebCore/DerivedSources/unified-sources/UnifiedSource-3c72abbe-10.cpp.o
In file included from /home/mcatanzaro/Projects/WebKit/WebKitBuild/gtk4/WebCore/DerivedSources/unified-sources/UnifiedSource-3c72abbe-10.cpp:4:
/home/mcatanzaro/Projects/WebKit/Source/WebCore/platform/SharedBuffer.cpp:623:78: warning: the two-parameter std::span construction is unsafe as it can introduce mismatch between buffer size and the bound information [-Wunsafe-buffer-usage-in-container]
  623 |         [](const GRefPtr<GBytes>& data) -> std::span<const uint8_t> { return { static_cast<const uint8_t*>(g_bytes_get_data(data.get(), nullptr)), g_bytes_get_size(data.get()) }; },
      |                                                                              ^
/home/mcatanzaro/Projects/WebKit/Source/WebCore/platform/SharedBuffer.cpp:626:91: warning: the two-parameter std::span construction is unsafe as it can introduce mismatch between buffer size and the bound information [-Wunsafe-buffer-usage-in-container]
  626 |         [](const RefPtr<GstMappedOwnedBuffer>& data) -> std::span<const uint8_t> { return { data->data(), data->size() }; },
      |                                                                                           ^
/home/mcatanzaro/Projects/WebKit/Source/WebCore/platform/SharedBuffer.cpp:629:76: warning: the two-parameter std::span construction is unsafe as it can introduce mismatch between buffer size and the bound information [-Wunsafe-buffer-usage-in-container]
  629 |         [](const sk_sp<SkData>& data) -> std::span<const uint8_t> { return { data->bytes(), data->size() }; },
      |                                                                            ^
3 warnings generated.
[3345/5505] Building CXX object Source/WebCore/CMakeFiles/WebCore.dir/__/__/WebCore/DerivedSources/unified-sources/UnifiedSource-3c72abbe-13.cpp.o
In file included from /home/mcatanzaro/Projects/WebKit/WebKitBuild/gtk4/WebCore/DerivedSources/unified-sources/UnifiedSource-3c72abbe-13.cpp:3:
/home/mcatanzaro/Projects/WebKit/Source/WebCore/platform/WebCorePersistentCoders.cpp:437:39: warning: the two-parameter std::span construction is unsafe as it can introduce mismatch between buffer size and the bound information [-Wunsafe-buffer-usage-in-container]
  437 |         encoder.encodeFixedLengthData({ byteArray->data, byteArray->len });
      |                                       ^
/home/mcatanzaro/Projects/WebKit/Source/WebCore/platform/WebCorePersistentCoders.cpp:449:44: warning: the two-parameter std::span construction is unsafe as it can introduce mismatch between buffer size and the bound information [-Wunsafe-buffer-usage-in-container]
  449 |         if (!decoder.decodeFixedLengthData({ byteArray->data, *size }))
      |                                            ^
2 warnings generated.
[3350/5505] Building CXX object Source/WebCore/CMakeFiles/WebCore.dir/__/__/WebCore/DerivedSources/unified-sources/UnifiedSource-3c72abbe-19.cpp.o
In file included from /home/mcatanzaro/Projects/WebKit/WebKitBuild/gtk4/WebCore/DerivedSources/unified-sources/UnifiedSource-3c72abbe-19.cpp:5:
/home/mcatanzaro/Projects/WebKit/Source/WebCore/platform/audio/glib/AudioBusGLib.cpp:43:43: warning: the two-parameter std::span construction is unsafe as it can introduce mismatch between buffer size and the bound information [-Wunsafe-buffer-usage-in-container]
   43 |     return createBusFromInMemoryAudioFile(std::span(static_cast<const uint8_t*>(g_bytes_get_data(data.get(), nullptr)), g_bytes_get_size(data.get())), false, sampleRate);
      |                                           ^
In file included from /home/mcatanzaro/Projects/WebKit/WebKitBuild/gtk4/WebCore/DerivedSources/unified-sources/UnifiedSource-3c72abbe-19.cpp:8:
/home/mcatanzaro/Projects/WebKit/Source/WebCore/platform/audio/gstreamer/AudioDecoderGStreamer.cpp:131:32: warning: the two-parameter std::span construction is unsafe as it can introduce mismatch between buffer size and the bound information [-Wunsafe-buffer-usage-in-container]
  131 |         return decoder->decode({ value.data(), value.size() }, isKeyFrame, timestamp, duration);
      |                                ^
2 warnings generated.
[3373/5505] Building CXX object Source/WebCore/CMakeFiles/WebCore.dir/__/__/WebCore/DerivedSources/unified-sources/UnifiedSource-3c72abbe-41.cpp.o
In file included from /home/mcatanzaro/Projects/WebKit/WebKitBuild/gtk4/WebCore/DerivedSources/unified-sources/UnifiedSource-3c72abbe-41.cpp:5:
/home/mcatanzaro/Projects/WebKit/Source/WebCore/platform/graphics/WOFFFileFormat.cpp:75:29: warning: the two-parameter std::span construction is unsafe as it can introduce mismatch between buffer size and the bound information [-Wunsafe-buffer-usage-in-container]
   75 |     return vector.tryAppend(std::span { reinterpret_cast_ptr<uint8_t*>(&bigEndianValue), sizeof(bigEndianValue) });
      |                             ^
/home/mcatanzaro/Projects/WebKit/Source/WebCore/platform/graphics/WOFFFileFormat.cpp:81:29: warning: the two-parameter std::span construction is unsafe as it can introduce mismatch between buffer size and the bound information [-Wunsafe-buffer-usage-in-container]
   81 |     return vector.tryAppend(std::span { reinterpret_cast_ptr<uint8_t*>(&bigEndianValue), sizeof(bigEndianValue) });
      |                             ^
/home/mcatanzaro/Projects/WebKit/Source/WebCore/platform/graphics/WOFFFileFormat.cpp:112:25: warning: the two-parameter std::span construction is unsafe as it can introduce mismatch between buffer size and the bound information [-Wunsafe-buffer-usage-in-container]
  112 |         m_vector.append(std::span { static_cast<const uint8_t*>(data), n });
      |                         ^
3 warnings generated.
[3397/5505] Building CXX object Source/WebCore/CMakeFiles/WebCore.dir/__/__/WebCore/DerivedSources/unified-sources/UnifiedSource-3c72abbe-57.cpp.o
In file included from /home/mcatanzaro/Projects/WebKit/WebKitBuild/gtk4/WebCore/DerivedSources/unified-sources/UnifiedSource-3c72abbe-57.cpp:5:
/home/mcatanzaro/Projects/WebKit/Source/WebCore/platform/graphics/gtk/ImageAdapterGtk.cpp:45:40: warning: the two-parameter std::span construction is unsafe as it can introduce mismatch between buffer size and the bound information [-Wunsafe-buffer-usage-in-container]
   45 |     icon->setData(SharedBuffer::create(std::span { static_cast<const uint8_t*>(g_bytes_get_data(data.get(), nullptr)), g_bytes_get_size(data.get()) }), true);
      |                                        ^
1 warning generated.
[3406/5505] Building CXX object Source/WebCore/CMakeFiles/WebCore.dir/__/__/WebCore/DerivedSources/unified-sources/UnifiedSource-3c72abbe-66.cpp.o
In file included from /home/mcatanzaro/Projects/WebKit/WebKitBuild/gtk4/WebCore/DerivedSources/unified-sources/UnifiedSource-3c72abbe-66.cpp:8:
/home/mcatanzaro/Projects/WebKit/Source/WebCore/platform/gstreamer/GStreamerQuirks.cpp:79:29: warning: the two-parameter std::span construction is unsafe as it can introduce mismatch between buffer size and the bound information [-Wunsafe-buffer-usage-in-container]
   79 |         StringView quirks { std::span { quirksList, strlen(quirksList) } };
      |                             ^
/home/mcatanzaro/Projects/WebKit/Source/WebCore/platform/gstreamer/GStreamerQuirks.cpp:117:29: warning: the two-parameter std::span construction is unsafe as it can introduce mismatch between buffer size and the bound information [-Wunsafe-buffer-usage-in-container]
  117 |     StringView identifier { std::span { holePunchQuirk, strlen(holePunchQuirk) } };
      |                             ^
2 warnings generated.
[3410/5505] Building CXX object Source/WebCore/CMakeFiles/WebCore.dir/__/__/WebCore/DerivedSources/unified-sources/UnifiedSource-3c72abbe-53.cpp.o
In file included from /home/mcatanzaro/Projects/WebKit/WebKitBuild/gtk4/WebCore/DerivedSources/unified-sources/UnifiedSource-3c72abbe-53.cpp:2:
/home/mcatanzaro/Projects/WebKit/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp:343:43: warning: the two-parameter std::span construction is unsafe as it can introduce mismatch between buffer size and the bound information [-Wunsafe-buffer-usage-in-container]
  343 |     auto optionsString = String::fromUTF8(std::span(contents.get(), length));
      |                                           ^
/home/mcatanzaro/Projects/WebKit/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp:913:12: warning: the two-parameter std::span construction is unsafe as it can introduce mismatch between buffer size and the bound information [-Wunsafe-buffer-usage-in-container]
  913 |     return std::span<const uint8_t> { data(), size() };
      |            ^
2 warnings generated.
[3416/5505] Building CXX object Source/WebCore/CMakeFiles/WebCore.dir/__/__/WebCore/DerivedSources/unified-sources/UnifiedSource-3c72abbe-82.cpp.o
In file included from /home/mcatanzaro/Projects/WebKit/WebKitBuild/gtk4/WebCore/DerivedSources/unified-sources/UnifiedSource-3c72abbe-82.cpp:7:
/home/mcatanzaro/Projects/WebKit/Source/WebCore/platform/network/soup/CertificateInfoSoup.cpp:133:48: warning: the two-parameter std::span construction is unsafe as it can introduce mismatch between buffer size and the bound information [-Wunsafe-buffer-usage-in-container]
  133 |             summaryInfo.dnsNames.append(String({ static_cast<const char*>(data), dataLength }));
      |                                                ^
1 warning generated.
[3417/5505] Building CXX object Source/WebCore/CMakeFiles/WebCore.dir/__/__/WebCore/DerivedSources/unified-sources/UnifiedSource-3c72abbe-69.cpp.o
In file included from /home/mcatanzaro/Projects/WebKit/WebKitBuild/gtk4/WebCore/DerivedSources/unified-sources/UnifiedSource-3c72abbe-69.cpp:3:
/home/mcatanzaro/Projects/WebKit/Source/WebCore/platform/mediarecorder/MediaRecorderPrivateGStreamer.cpp:479:19: warning: the two-parameter std::span construction is unsafe as it can introduce mismatch between buffer size and the bound information [-Wunsafe-buffer-usage-in-container]
  479 |     m_data.append(std::span<const uint8_t> { buffer.data(), buffer.size() });
      |                   ^
1 warning generated.
[3424/5505] Building CXX object Source/WebCore/CMakeFiles/WebCore.dir/__/__/WebCore/DerivedSources/unified-sources/UnifiedSource-3c72abbe-67.cpp.o
In file included from /home/mcatanzaro/Projects/WebKit/WebKitBuild/gtk4/WebCore/DerivedSources/unified-sources/UnifiedSource-3c72abbe-67.cpp:8:
/home/mcatanzaro/Projects/WebKit/Source/WebCore/platform/gtk/PlatformKeyboardEventGtk.cpp:1323:29: warning: the two-parameter std::span construction is unsafe as it can introduce mismatch between buffer size and the bound information [-Wunsafe-buffer-usage-in-container]
 1323 |             retVal = String({ (UChar*)uchar16, static_cast<size_t>(nwc) });
      |                             ^
1 warning generated.
[3428/5505] Building CXX object Source/WebCore/CMakeFiles/WebCore.dir/__/__/WebCore/DerivedSources/unified-sources/UnifiedSource-3c72abbe-83.cpp.o
In file included from /home/mcatanzaro/Projects/WebKit/WebKitBuild/gtk4/WebCore/DerivedSources/unified-sources/UnifiedSource-3c72abbe-83.cpp:3:
/home/mcatanzaro/Projects/WebKit/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp:206:71: warning: the two-parameter std::span construction is unsafe as it can introduce mismatch between buffer size and the bound information [-Wunsafe-buffer-usage-in-container]
  206 |             data->completionHandler(Credential(user, String::fromUTF8({ passwordData, length }), CredentialPersistence::Permanent));
      |                                                                       ^
In file included from /home/mcatanzaro/Projects/WebKit/WebKitBuild/gtk4/WebCore/DerivedSources/unified-sources/UnifiedSource-3c72abbe-83.cpp:7:
/home/mcatanzaro/Projects/WebKit/Source/WebCore/platform/network/soup/SoupNetworkSession.cpp:91:26: warning: the two-parameter std::span construction is unsafe as it can introduce mismatch between buffer size and the bound information [-Wunsafe-buffer-usage-in-container]
   91 |         digest->addBytes(std::span { certificateData->data, certificateData->len });
      |                          ^
2 warnings generated.
[3429/5505] Building CXX object Source/WebCore/CMakeFiles/WebCore.dir/__/__/WebCore/DerivedSources/unified-sources/UnifiedSource-3c72abbe-54.cpp.o
In file included from /home/mcatanzaro/Projects/WebKit/WebKitBuild/gtk4/WebCore/DerivedSources/unified-sources/UnifiedSource-3c72abbe-54.cpp:2:
/home/mcatanzaro/Projects/WebKit/Source/WebCore/platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp:134:79: warning: the two-parameter std::span construction is unsafe as it can introduce mismatch between buffer size and the bound information [-Wunsafe-buffer-usage-in-container]
  134 |             downcast<InbandTextTrackPrivateClient>(client).parseWebVTTCueData(std::span { mappedBuffer.data(), mappedBuffer.size() });
      |                                                                               ^
In file included from /home/mcatanzaro/Projects/WebKit/WebKitBuild/gtk4/WebCore/DerivedSources/unified-sources/UnifiedSource-3c72abbe-54.cpp:7:
/home/mcatanzaro/Projects/WebKit/Source/WebCore/platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:375:60: warning: the two-parameter std::span construction is unsafe as it can introduce mismatch between buffer size and the bound information [-Wunsafe-buffer-usage-in-container]
  375 |     auto trackID = WTF::parseInteger<TrackID>(StringView { std::span { trackIDString.get(), strlen(trackIDString.get()) } });
      |                                                            ^
In file included from /home/mcatanzaro/Projects/WebKit/WebKitBuild/gtk4/WebCore/DerivedSources/unified-sources/UnifiedSource-3c72abbe-54.cpp:8:
/home/mcatanzaro/Projects/WebKit/Source/WebCore/platform/graphics/gstreamer/VideoDecoderGStreamer.cpp:134:32: warning: the two-parameter std::span construction is unsafe as it can introduce mismatch between buffer size and the bound information [-Wunsafe-buffer-usage-in-container]
  134 |         return decoder->decode({ value.data(), value.size() }, isKeyFrame, timestamp, duration);
      |                                ^
3 warnings generated.
[3459/5505] Building CXX object Source/WebCore/CMakeFiles/WebCore.dir/__/__/WebCore/DerivedSources/unified-sources/UnifiedSource-043dd90b-18.cpp.o
In file included from /home/mcatanzaro/Projects/WebKit/WebKitBuild/gtk4/WebCore/DerivedSources/unified-sources/UnifiedSource-043dd90b-18.cpp:4:
/home/mcatanzaro/Projects/WebKit/Source/WebCore/rendering/adwaita/RenderThemeAdwaita.cpp:234:33: warning: the two-parameter std::span construction is unsafe as it can introduce mismatch between buffer size and the bound information [-Wunsafe-buffer-usage-in-container]
  234 |     return base64EncodeToString({ static_cast<const uint8_t*>(g_bytes_get_data(data.get(), nullptr)), g_bytes_get_size(data.get()) });
      |                                 ^
1 warning generated.
[4838/5505] Building CXX object Source/WebKit/CMakeFiles/WebKit.dir/Shared/skia/WebCoreArgumentCodersSkia.cpp.o
/home/mcatanzaro/Projects/WebKit/Source/WebKit/Shared/skia/WebCoreArgumentCodersSkia.cpp:42:16: warning: the two-parameter std::span construction is unsafe as it can introduce mismatch between buffer size and the bound information [-Wunsafe-buffer-usage-in-container]
   42 |     encoder << std::span { string.data(), string.size() };
      |                ^
1 warning generated.
[5127/5505] Building CXX object Source/WebKit/CMakeFiles/WebKit.dir/UIProcess/API/glib/WebKitWebResource.cpp.o
/home/mcatanzaro/Projects/WebKit/Source/WebKit/UIProcess/API/glib/WebKitWebResource.cpp:365:43: warning: the two-parameter std::span construction is unsafe as it can introduce mismatch between buffer size and the bound information [-Wunsafe-buffer-usage-in-container]
  365 |         data->webData = API::Data::create({ reinterpret_cast<const uint8_t*>(""), 1 });
      |                                           ^

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20241125/10c77881/attachment-0001.htm>


More information about the webkit-unassigned mailing list