diff mbox series

[FFmpeg-devel,1/4] lavc/ac3dec: fail when the sample rate is unset

Message ID 20230105110756.473-1-anton@khirnov.net
State Accepted
Commit 3dc7a9f6239d909b3e66712b32380822466882af
Headers show
Series [FFmpeg-devel,1/4] lavc/ac3dec: fail when the sample rate is unset | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Anton Khirnov Jan. 5, 2023, 11:07 a.m. UTC
---
 libavcodec/ac3dec.c | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index 1f2949dcfd..0b120e6140 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -1716,6 +1716,11 @@  skip:
         avctx->bit_rate    = s->bit_rate + s->prev_bit_rate;
     }
 
+    if (!avctx->sample_rate) {
+        av_log(avctx, AV_LOG_ERROR, "Could not determine the sample rate\n");
+        return AVERROR_INVALIDDATA;
+    }
+
     for (ch = 0; ch < EAC3_MAX_CHANNELS; ch++)
         extended_channel_map[ch] = ch;