PR #22615 opened by Priyanshuthapliyal
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22615
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22615.patch

The return value of read_diff_float_data() was previously ignored, allowing 
decode to continue silently with partially transformed samples on malformed 
floating ALS input.

Check and propagate the error.

All failure paths in read_diff_float_data() already return AVERROR_INVALIDDATA, 
so the caller fix is sufficient without any normalization inside the function.

Follows up on [#22599](https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22599) which 
fixed abs(INT_MIN) UB in read_diff_float_data() but left the return value 
unchecked at the call site in read_frame_data().

Signed-off-by: Priyanshu Thapliyal <[email protected]>


>From e4e7c717dff43926b8b30db523c7cc115a7ef973 Mon Sep 17 00:00:00 2001
From: Priyanshu Thapliyal <[email protected]>
Date: Wed, 25 Mar 2026 13:36:07 +0530
Subject: [PATCH] avcodec/alsdec: propagate read_diff_float_data() errors in
 read_frame_data()

The return value of read_diff_float_data() was previously ignored,
allowing decode to continue silently with partially transformed samples
on malformed floating ALS input. Check and propagate the error.

All failure paths in read_diff_float_data() already return
AVERROR_INVALIDDATA, so the caller fix is sufficient without
any normalization inside the function.

Signed-off-by: Priyanshu Thapliyal <[email protected]>
---
 libavcodec/alsdec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index e91ff57b03..0fd474f18e 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -1790,7 +1790,9 @@ static int read_frame_data(ALSDecContext *ctx, unsigned 
int ra_frame)
     }
 
     if (sconf->floating) {
-        read_diff_float_data(ctx, ra_frame);
+        ret = read_diff_float_data(ctx, ra_frame);
+        if (ret < 0)
+            return ret;
     }
 
     if (get_bits_left(gb) < 0) {
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to