[FFmpeg-devel] [PATCH 3/5] avcodec/ac3_parser: Check init_get_bits8() for failure
Michael Niedermayer
michael at niedermayer.cc
Mon Apr 29 00:30:50 EEST 2024
Fixes: CID1420393 Unchecked return value
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
libavcodec/ac3_parser.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/libavcodec/ac3_parser.c b/libavcodec/ac3_parser.c
index 4152fd4e018..4e0ba734818 100644
--- a/libavcodec/ac3_parser.c
+++ b/libavcodec/ac3_parser.c
@@ -204,7 +204,9 @@ int av_ac3_parse_header(const uint8_t *buf, size_t size,
AC3HeaderInfo hdr;
int err;
- init_get_bits8(&gb, buf, size);
+ err = init_get_bits8(&gb, buf, size);
+ if (err < 0)
+ return AVERROR_INVALIDDATA;
err = ff_ac3_parse_header(&gb, &hdr);
if (err < 0)
return AVERROR_INVALIDDATA;
--
2.43.2
More information about the ffmpeg-devel
mailing list