From f0007ee8579f97999d69bbc6d7f9ac166a06fddb Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 16 Dec 2024 11:45:27 +0100 Subject: [PATCH 4/9] qtdemux: Avoid integer overflow when parsing Theora extension Thanks to Antonio Morales for finding and reporting the issue. Fixes GHSL-2024-166 Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3851 Part-of: --- gst/isomp4/qtdemux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c index ad07c1e36..229edb3e5 100644 --- a/gst/isomp4/qtdemux.c +++ b/gst/isomp4/qtdemux.c @@ -7816,7 +7816,7 @@ qtdemux_parse_theora_extension (GstQTDemux * qtdemux, QtDemuxStream * stream, end -= 8; while (buf < end) { - gint size; + guint32 size; guint32 type; size = QT_UINT32 (buf); @@ -7824,7 +7824,7 @@ qtdemux_parse_theora_extension (GstQTDemux * qtdemux, QtDemuxStream * stream, GST_LOG_OBJECT (qtdemux, "%p %p", buf, end); - if (buf + size > end || size <= 0) + if (end - buf < size || size < 8) break; buf += 8; -- 2.47.0