Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 620800 - media-libs/libtheora-1.1.1-r1: Triggers undefined behaviour
Summary: media-libs/libtheora-1.1.1-r1: Triggers undefined behaviour
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Stabilization (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Media-video project
URL:
Whiteboard:
Keywords: PATCH, STABLEREQ
Depends on:
Blocks:
 
Reported: 2017-06-04 15:50 UTC by moatu
Modified: 2018-11-26 20:40 UTC (History)
1 user (show)

See Also:
Package list:
media-libs/libtheora-1.1.1-r2
Runtime testing required: ---
stable-bot: sanity-check+


Attachments
Slightly backported upstream commit 0ae66d565e6bead8604d312bc1a4e9dccf245c88 (libtheora-1.1.1-Fix-pp_sharp_mod-calculation.patch,1.46 KB, patch)
2017-06-04 15:50 UTC, moatu
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description moatu 2017-06-04 15:50:01 UTC
Created attachment 475170 [details, diff]
Slightly backported upstream commit 0ae66d565e6bead8604d312bc1a4e9dccf245c88

GCC 4.8 uses aggressive loop optimization by default. This triggers undefined behaviour in libtheora

/var/tmp/portage/media-libs/libtheora-1.1.1-r1/work/libtheora-1.1.1/lib/decode.c: In function ‘th_decode_alloc’:
/var/tmp/portage/media-libs/libtheora-1.1.1-r1/work/libtheora-1.1.1/lib/decode.c:400:49: warning: iteration 2u invokes undefined behavior [-Waggressive-loop-optimizations]
       qsum+=_dec->state.dequant_tables[qti][pli][qi][12]+
                                                 ^
/var/tmp/portage/media-libs/libtheora-1.1.1-r1/work/libtheora-1.1.1/lib/decode.c:396:3: note: containing loop
   for(qi=0;qi<64;qi++){
   ^

This was fixed upstream five years ago [0] but no release was made since then.
Please apply this patch, thanks.

Attached the slightly backported patch (thunk header line was changed from 400 to 397 to match the libtheora-1.1.1 tarball; without this change the patch still applies but issues a hunk offset warning).

[0] https://git.xiph.org/?p=theora.git;a=commit;h=0ae66d565e6bead8604d312bc1a4e9dccf245c88
Comment 1 Larry the Git Cow gentoo-dev 2018-10-04 00:01:26 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=92a952a998d41206b6af06fe2d9c3eb9ab2e3f4a

commit 92a952a998d41206b6af06fe2d9c3eb9ab2e3f4a
Author:     Andreas Sturmlechner <asturm@gentoo.org>
AuthorDate: 2018-10-03 23:53:25 +0000
Commit:     Andreas Sturmlechner <asturm@gentoo.org>
CommitDate: 2018-10-04 00:01:17 +0000

    media-libs/libtheora: Fix undefined behaviour, EAPI-7 bump
    
    Thanks-to: <moatu@opentrash.com>
    Bug: https://bugs.gentoo.org/620800
    Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
    Package-Manager: Portage-2.3.50, Repoman-2.3.11

 .../files/libtheora-1.0_beta2-flags.patch          |  4 +-
 .../libtheora/files/libtheora-1.1.1-fix-UB.patch   | 47 ++++++++++
 .../libtheora/files/libtheora-1.1.1-libpng16.patch |  4 +-
 .../files/libtheora-1.1.1-underlinking.patch       |  4 +-
 media-libs/libtheora/libtheora-1.1.1-r2.ebuild     | 99 ++++++++++++++++++++++
 5 files changed, 152 insertions(+), 6 deletions(-)
Comment 2 Sergei Trofimovich (RETIRED) gentoo-dev 2018-10-04 23:12:50 UTC
ia64 stable
Comment 3 Thomas Deutschmann (RETIRED) gentoo-dev 2018-10-05 04:52:42 UTC
x86 stable
Comment 4 Matt Turner gentoo-dev 2018-10-06 16:15:37 UTC
ppc/ppc64 stable
Comment 5 Sergei Trofimovich (RETIRED) gentoo-dev 2018-10-06 22:31:48 UTC
hppa stable
Comment 6 moatu 2018-10-07 06:19:04 UTC
Thanks arches and Andreas for solving this issue. Keep up the good work!
Comment 7 Mikle Kolyada (RETIRED) archtester Gentoo Infrastructure gentoo-dev Security 2018-10-07 12:07:56 UTC
amd64 stable
Comment 8 Tobias Klausmann (RETIRED) gentoo-dev 2018-10-13 06:58:03 UTC
Stable on alpha.
Comment 9 Mikle Kolyada (RETIRED) archtester Gentoo Infrastructure gentoo-dev Security 2018-11-18 11:58:01 UTC
arm stable
Comment 10 Larry the Git Cow gentoo-dev 2018-11-26 07:12:08 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8a27f63ff3786a453e980e0ed13d849f6f27e5f2

commit 8a27f63ff3786a453e980e0ed13d849f6f27e5f2
Author:     Rolf Eike Beer <eike@sf-mail.de>
AuthorDate: 2018-11-26 07:02:03 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2018-11-26 07:11:53 +0000

    media-libs/libtheora: stable 1.1.1-r2 for sparc
    
    Closes: https://bugs.gentoo.org/620800
    Signed-off-by: Rolf Eike Beer <eike@sf-mail.de>
    Package-Manager: Portage-2.3.51, Repoman-2.3.11
    RepoMan-Options: --include-arches="sparc"
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 media-libs/libtheora/libtheora-1.1.1-r2.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)