From 565632119ffcf5fa0430334c7f59e9a9870ec90a Mon Sep 17 00:00:00 2001 From: Kalev Lember Date: Mon, 4 Dec 2023 14:00:17 +0100 Subject: [PATCH] Fix off by one regression in decoder https://github.com/cisco/openh264/pull/3704 --- ...ff-by-one-regression-in-decoder-3704.patch | 29 +++++++++++++++++++ openh264.spec | 9 +++++- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 0001-Fix-off-by-one-regression-in-decoder-3704.patch diff --git a/0001-Fix-off-by-one-regression-in-decoder-3704.patch b/0001-Fix-off-by-one-regression-in-decoder-3704.patch new file mode 100644 index 0000000..699281d --- /dev/null +++ b/0001-Fix-off-by-one-regression-in-decoder-3704.patch @@ -0,0 +1,29 @@ +From fd66e67ac6136aff80b1567488568ba1ed7e8fb8 Mon Sep 17 00:00:00 2001 +From: Kalev Lember +Date: Mon, 4 Dec 2023 07:54:04 +0100 +Subject: [PATCH] Fix off by one regression in decoder (#3704) + +Fix iPicBuffIdx bounds check introduced in commit +986bd65b711191d4883c54ace32a9879e17729c2 and allow 0 as an index value. + +This fixes Big_Buck_Bunny_720_10s_30MB.mp4 playback with gst-play-1.0. +--- + codec/decoder/plus/src/welsDecoderExt.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/codec/decoder/plus/src/welsDecoderExt.cpp b/codec/decoder/plus/src/welsDecoderExt.cpp +index 170d17de..457effb6 100644 +--- a/codec/decoder/plus/src/welsDecoderExt.cpp ++++ b/codec/decoder/plus/src/welsDecoderExt.cpp +@@ -1136,7 +1136,7 @@ void CWelsDecoder::ReleaseBufferedReadyPictureReorder (PWelsDecoderContext pCtx, + m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].iPOC = IMinInt32; + int32_t iPicBuffIdx = m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].iPicBuffIdx; + if (pPicBuff != NULL) { +- if (iPicBuffIdx > 0 && iPicBuffIdx < pPicBuff->iCapacity) ++ if (iPicBuffIdx >= 0 && iPicBuffIdx < pPicBuff->iCapacity) + { + PPicture pPic = pPicBuff->ppPic[iPicBuffIdx]; + --pPic->iRefCount; +-- +2.41.0 + diff --git a/openh264.spec b/openh264.spec index f0bb962..a28f667 100644 --- a/openh264.spec +++ b/openh264.spec @@ -9,7 +9,7 @@ Name: openh264 Version: %{openh264_version} # Also bump the Release tag for gstreamer1-plugin-openh264 down below -Release: 1%{?dist} +Release: 2%{?dist} Summary: H.264 codec library License: BSD-2-Clause @@ -22,6 +22,9 @@ Source1: https://github.com/mozilla/gmp-api/archive/%{commit1}/gmp-api-%{ Source2: gst-plugins-bad-openh264-%{gst_version}.tar.xz Source3: gst-p-bad-cleanup.sh +# Backported from upstream +# https://github.com/cisco/openh264/pull/3704 +Patch1: 0001-Fix-off-by-one-regression-in-decoder-3704.patch # Don't use pkg-config for finding openh264 as we are building against an in-tree copy Patch2: hardcode-openh264-dep.patch @@ -75,6 +78,7 @@ This package contains the H.264 plugin. %prep %setup -q +%patch1 -p1 # Extract gmp-api archive tar -xf %{S:1} @@ -229,6 +233,9 @@ popd %changelog +* Mon Dec 04 2023 Kalev Lember - 2.4.0-2 +- Fix off by one regression in decoder + * Fri Nov 24 2023 Kalev Lember - 2.4.0-1 - Update to 2.4.0 - Obsolete noopenh264 stub package