[FFmpeg-devel] [PATCH v1 1/1] avcodec/vorbisdec: Return value check for init_get_bits
maryam ebrahimzadeh
me22bee at outlook.com
Mon Aug 30 07:05:59 EEST 2021
avcodec/vorbisdec: Return value check for init_get_bits
As the second argument for init_get_bits can be crafted,
a return value check for this function call is necessary.
Also replace init_get_bits with init_get_bits8.
---
libavcodec/vorbisdec.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c
index dac2b6841c..80358f6359 100644
--- a/libavcodec/vorbisdec.c
+++ b/libavcodec/vorbisdec.c
@@ -1052,7 +1052,9 @@ static av_cold int vorbis_decode_init(AVCodecContext *avctx)
return ret;
}
- init_get_bits(gb, header_start[0], header_len[0]*8);
+ ret = init_get_bits8(gb, header_start[0], header_len[0]);
+ if (ret < 0)
+ return ret;
hdr_type = get_bits(gb, 8);
if (hdr_type != 1) {
av_log(avctx, AV_LOG_ERROR, "First header is not the id header.\n");
@@ -1064,7 +1066,9 @@ static av_cold int vorbis_decode_init(AVCodecContext *avctx)
return ret;
}
- init_get_bits(gb, header_start[2], header_len[2]*8);
+ ret = init_get_bits8(gb, header_start[2], header_len[2]);
+ if (ret < 0)
+ return ret;
hdr_type = get_bits(gb, 8);
if (hdr_type != 5) {
av_log(avctx, AV_LOG_ERROR, "Third header is not the setup header.\n");
--
2.17.1
More information about the ffmpeg-devel
mailing list