From 801dbaa387027ba51db546c6a6d9c8cd9557d152 Mon Sep 17 00:00:00 2001 From: Andrey Akhmichin <15944199+nekonomicon@users.noreply.github.com> Date: Wed, 25 Jan 2023 04:32:48 +0500 Subject: [PATCH] engine: common: soundlib: libmpg: backport fix for CVE-2017-11126. Original patch: https://www.mpg123.de/cgi-bin/scm/mpg123/trunk/src/libmpg123/layer3.c?view=patch&r1=4275&r2=4274 Same as: https://github.com/tyabus/xash3d/commit/f246a0cdfd9f142cedebb97810cfa211adb60fed --- engine/common/soundlib/libmpg/layer3.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/engine/common/soundlib/libmpg/layer3.c b/engine/common/soundlib/libmpg/layer3.c index e4e1228c..5b1b7adb 100644 --- a/engine/common/soundlib/libmpg/layer3.c +++ b/engine/common/soundlib/libmpg/layer3.c @@ -35,10 +35,10 @@ static float tan1_1[16]; static float tan2_1[16]; static float tan1_2[16]; static float tan2_2[16]; -static float pow1_1[2][16]; -static float pow2_1[2][16]; -static float pow1_2[2][16]; -static float pow2_2[2][16]; +static float pow1_1[2][32]; +static float pow2_1[2][32]; +static float pow1_2[2][32]; +static float pow2_2[2][32]; static int mapbuf0[9][152]; static int mapbuf1[9][156]; static int mapbuf2[9][44]; @@ -217,7 +217,10 @@ void init_layer3( void ) tan2_1[i] = DOUBLE_TO_REAL_15( 1.0 / (1.0 + t)); tan1_2[i] = DOUBLE_TO_REAL_15( M_SQRT2 * t / (1.0 + t)); tan2_2[i] = DOUBLE_TO_REAL_15( M_SQRT2 / (1.0 + t)); + } + for( i = 0; i < 32; i++ ) + { for( j = 0; j < 2; j++ ) { double base = pow( 2.0, -0.25 * (j + 1.0));