Accepting request 794365 from home:gboiko:branches:multimedia:libs

- Backport of an upstream fix for celt decoder:
  * opus-Fix-celt-decoder-assertion-when-using-OPUS_CUSTOM.patch: When
    using OPUS_CUSTOM, `CELTDecoder->end` can be larger than 21.
    Assert against 25 instead in OPUS_CUSTOM builds.

This patch is intended to fix a crash in Jamulus, originally reported here:
https://sourceforge.net/p/llcon/discussion/software/thread/7fdbc8cbb0/

OBS-URL: https://build.opensuse.org/request/show/794365
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/opus?expand=0&rev=43
This commit is contained in:
Takashi Iwai 2020-04-21 07:37:55 +00:00 committed by Git OBS Bridge
parent 5914ab837d
commit 7f279db047
3 changed files with 53 additions and 1 deletions

View File

@ -0,0 +1,41 @@
From 06a651547f4a197c29b6abc23b530833855ee358 Mon Sep 17 00:00:00 2001
From: Niclas Olmenius <niclas@voysys.se>
Date: Wed, 19 Feb 2020 13:58:35 +0100
Subject: [PATCH] Fix celt decoder assertion when using OPUS_CUSTOM
When using OPUS_CUSTOM, `CELTDecoder->end` can be larger than 21.
Assert against 25 instead in OPUS_CUSTOM builds.
Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
---
celt/celt_decoder.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/celt/celt_decoder.c b/celt/celt_decoder.c
index e6efce93..74ca3b74 100644
--- a/celt/celt_decoder.c
+++ b/celt/celt_decoder.c
@@ -117,13 +117,19 @@ void validate_celt_decoder(CELTDecoder *st)
#ifndef CUSTOM_MODES
celt_assert(st->mode == opus_custom_mode_create(48000, 960, NULL));
celt_assert(st->overlap == 120);
+ celt_assert(st->end <= 21);
+#else
+/* From Section 4.3 in the spec: "The normal CELT layer uses 21 of those bands,
+ though Opus Custom (see Section 6.2) may use a different number of bands"
+
+ Check if it's within the maximum number of Bark frequency bands instead */
+ celt_assert(st->end <= 25);
#endif
celt_assert(st->channels == 1 || st->channels == 2);
celt_assert(st->stream_channels == 1 || st->stream_channels == 2);
celt_assert(st->downsample > 0);
celt_assert(st->start == 0 || st->start == 17);
celt_assert(st->start < st->end);
- celt_assert(st->end <= 21);
#ifdef OPUS_ARCHMASK
celt_assert(st->arch >= 0);
celt_assert(st->arch <= OPUS_ARCHMASK);
--
2.26.0

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Wed Apr 15 17:38:39 UTC 2020 - Gustavo Pichorim Boiko <gboiko@suse.com>
- Backport of an upstream fix for celt decoder:
* opus-Fix-celt-decoder-assertion-when-using-OPUS_CUSTOM.patch: When
using OPUS_CUSTOM, `CELTDecoder->end` can be larger than 21.
Assert against 25 instead in OPUS_CUSTOM builds.
-------------------------------------------------------------------
Thu Aug 15 17:37:36 UTC 2019 - Bjørn Lie <bjorn.lie@gmail.com>

View File

@ -1,7 +1,7 @@
#
# spec file for package opus
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2020 SUSE LLC
# Copyright (c) 2012 Pascal Bleser <pascal.bleser@opensuse.org>
#
# All modifications and additions to the file contributed by third parties
@ -31,6 +31,8 @@ Source99: baselibs.conf
Patch0: opus-Silk-CNG-adapts-faster.patch
# PATCH-FIX-UPSTREAM opus-Silk-fix-arm-optimization.patch -- Avoid processing LPC coeffs beyond the given order in NEON optimizations
Patch1: opus-Silk-fix-arm-optimization.patch
# PATCH-FIX-UPSTREAM opus-Fix-celt-decoder-assertion-when-using-OPUS_CUSTOM.patch -- Fix celt decoder assertion when using OPUS_CUSTOM
Patch2: opus-Fix-celt-decoder-assertion-when-using-OPUS_CUSTOM.patch
BuildRequires: pkgconfig
%description
@ -61,6 +63,7 @@ technology from Skype's SILK codec and Xiph.Org's CELT codec.
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%build
%configure \