From 4356d4262e0d2c6bec8b4ebbd5f69c3b25eb551b Mon Sep 17 00:00:00 2001 From: Hosang Lee Date: Fri, 1 Dec 2023 14:51:49 +0900 Subject: [PATCH] qtdemux: Don't overflow sample index Don't reduce sample index if it is already at 0. Assigning -1 to a guint32 variable causes unexpected behavior. Part-of: --- subprojects/gst-plugins-good/gst/isomp4/qtdemux.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/subprojects/gst-plugins-good/gst/isomp4/qtdemux.c b/subprojects/gst-plugins-good/gst/isomp4/qtdemux.c index efdaa3f..6fdc5e7 100644 --- a/subprojects/gst-plugins-good/gst/isomp4/qtdemux.c +++ b/subprojects/gst-plugins-good/gst/isomp4/qtdemux.c @@ -5020,7 +5020,12 @@ gst_qtdemux_seek_to_previous_keyframe (GstQTDemux * qtdemux) } /* Remember until where we want to go */ - str->to_sample = str->from_sample - 1; + if (str->from_sample == 0) { + GST_LOG_OBJECT (qtdemux, "already at sample 0"); + str->to_sample = 0; + } else { + str->to_sample = str->from_sample - 1; + } /* Define our time position */ target_ts = str->samples[k_index].timestamp + str->samples[k_index].pts_offset; -- 2.7.4