diff --git a/Fix-intermediate-overflow-in-op_pcm_total.patch b/Fix-intermediate-overflow-in-op_pcm_total.patch new file mode 100644 index 0000000..cb98765 --- /dev/null +++ b/Fix-intermediate-overflow-in-op_pcm_total.patch @@ -0,0 +1,32 @@ +From 82adfb611d2c8c7f070297210c2b9854490887e5 Mon Sep 17 00:00:00 2001 +From: "Timothy B. Terriberry" +Date: Tue, 15 Dec 2020 16:23:16 -0800 +Subject: [PATCH] Fix intermediate overflow in op_pcm_total(). + +Although link enumeration ensures the return value is in range, the + order of operations allows the intermediate value pcm_total+diff + to overflow the range of a 64-bit int. +Add parentheses to ensure this does not happen. +Thanks to Felcia Lim for the report. + +Fixes #2330 +--- + src/opusfile.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/opusfile.c b/src/opusfile.c +index 5bf9f91..144e02c 100644 +--- a/src/opusfile.c ++++ b/src/opusfile.c +@@ -1753,7 +1753,7 @@ ogg_int64_t op_pcm_total(const OggOpusFile *_of,int _li){ + } + OP_ALWAYS_TRUE(!op_granpos_diff(&diff, + links[_li].pcm_end,links[_li].pcm_start)); +- return pcm_total+diff-links[_li].head.pre_skip; ++ return pcm_total+(diff-links[_li].head.pre_skip); + } + + const OpusHead *op_head(const OggOpusFile *_of,int _li){ +-- +2.27.0 + diff --git a/opusfile.spec b/opusfile.spec index 5fd18cc..fb22683 100644 --- a/opusfile.spec +++ b/opusfile.spec @@ -1,6 +1,6 @@ Name: opusfile Version: 0.11 -Release: 5 +Release: 6 Summary: A high-level API provides seeking, decode, and playback of Opus streams License: BSD URL: http://www.opus-codec.org/ @@ -8,6 +8,7 @@ Source0: http://downloads.xiph.org/releases/opus/%{name}-%{version}.tar.gz Patch0000: 0001-fix-MemorySanitizer-use-of-uninitialized-value.patch Patch0001: Fix-short-circuit-test-when-seeking-in-short-files.patch Patch0002: fix-left-shift.patch +Patch0003: Fix-intermediate-overflow-in-op_pcm_total.patch BuildRequires: libogg-devel openssl-devel opus-devel @@ -52,6 +53,9 @@ Development package for opusfile package. %{_libdir}/{libopusfile.so,libopusurl.so} %changelog +* Wed Dec 22 2021 xu_ping - 0.11-6 +- Fix intermediate overflow in op_pcm_total + * Tue Dec 14 2021 caodongxia - 0.11-5 - Fix left shift