Fix intermediate overflow in op_pcm_total
Signed-off-by: cherry530 <xuping33@huawei.com>
This commit is contained in:
parent
d081ad98e5
commit
5247c9d084
32
Fix-intermediate-overflow-in-op_pcm_total.patch
Normal file
32
Fix-intermediate-overflow-in-op_pcm_total.patch
Normal file
@ -0,0 +1,32 @@
|
||||
From 82adfb611d2c8c7f070297210c2b9854490887e5 Mon Sep 17 00:00:00 2001
|
||||
From: "Timothy B. Terriberry" <tterribe@xiph.org>
|
||||
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
|
||||
|
||||
@ -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 <xuping33@huawei.com> - 0.11-6
|
||||
- Fix intermediate overflow in op_pcm_total
|
||||
|
||||
* Tue Dec 14 2021 caodongxia <caodongxia@huawei.com> - 0.11-5
|
||||
- Fix left shift
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user