[FFmpeg-cvslog] avcodec/sga: av_assert1 check init_get_bits8()
Michael Niedermayer
git at videolan.org
Wed Aug 14 19:23:08 EEST 2024
ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Mon Aug 12 18:20:33 2024 +0200| [0f4524f07a93bf9061f9034ffa510d4bf9b582e8] | committer: Michael Niedermayer
avcodec/sga: av_assert1 check init_get_bits8()
Related: CID1473562 Unchecked return value
Related: CID1473592 Unchecked return value
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0f4524f07a93bf9061f9034ffa510d4bf9b582e8
---
libavcodec/sga.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/libavcodec/sga.c b/libavcodec/sga.c
index 618df000ad..c828f7147f 100644
--- a/libavcodec/sga.c
+++ b/libavcodec/sga.c
@@ -254,11 +254,13 @@ static int decode_palmapdata(AVCodecContext *avctx)
const int bits = (s->nb_pal + 1) / 2;
GetByteContext *gb = &s->gb;
GetBitContext pm;
+ int ret;
bytestream2_seek(gb, s->palmapdata_offset, SEEK_SET);
if (bytestream2_get_bytes_left(gb) < s->palmapdata_size)
return AVERROR_INVALIDDATA;
- init_get_bits8(&pm, gb->buffer, s->palmapdata_size);
+ ret = init_get_bits8(&pm, gb->buffer, s->palmapdata_size);
+ av_assert1(ret >= 0);
for (int y = 0; y < s->tiles_h; y++) {
uint8_t *dst = s->palmapindex_data + y * s->tiles_w;
@@ -277,11 +279,13 @@ static int decode_tiledata(AVCodecContext *avctx)
SGAVideoContext *s = avctx->priv_data;
GetByteContext *gb = &s->gb;
GetBitContext tm;
+ int ret;
bytestream2_seek(gb, s->tiledata_offset, SEEK_SET);
if (bytestream2_get_bytes_left(gb) < s->tiledata_size)
return AVERROR_INVALIDDATA;
- init_get_bits8(&tm, gb->buffer, s->tiledata_size);
+ ret = init_get_bits8(&tm, gb->buffer, s->tiledata_size);
+ av_assert1(ret >= 0);
for (int n = 0; n < s->nb_tiles; n++) {
uint8_t *dst = s->tileindex_data + n * 64;
More information about the ffmpeg-cvslog
mailing list