mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-05-08 20:13:23 +02:00
avcodec/alsdec: fix abs(INT_MIN) UB in read_diff_float_data()
Replace abs() with FFABSU() to avoid undefined behavior when
raw_samples[c][i] == INT_MIN. Per libavutil/common.h, FFABS()
has the same INT_MIN UB as abs(); FFABSU() is the correct
helper as it casts to unsigned before negation.
Reported-by: Guanni Qu <qguanni@gmail.com>
Signed-off-by: Priyanshu Thapliyal <priyanshuthapliyal2005@gmail.com>
(cherry picked from commit 1853c80e20)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
committed by
Michael Niedermayer
parent
a2f90b6dc9
commit
daf2cb8bfd
+1
-1
@@ -1541,7 +1541,7 @@ static int read_diff_float_data(ALSDecContext *ctx, unsigned int ra_frame) {
|
||||
if (ctx->raw_samples[c][i] != 0) {
|
||||
//The following logic is taken from Tabel 14.45 and 14.46 from the ISO spec
|
||||
if (av_cmp_sf_ieee754(acf[c], FLOAT_1)) {
|
||||
nbits[i] = 23 - av_log2(abs(ctx->raw_samples[c][i]));
|
||||
nbits[i] = 23 - av_log2(FFABSU(ctx->raw_samples[c][i]));
|
||||
} else {
|
||||
nbits[i] = 23;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user