[FFmpeg-devel] [PATCH 5/7] avcodec/avs3_parser: Check the return value of init_get_bits8()
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Thu May 2 11:28:36 EEST 2024
Michael Niedermayer:
> Fixes: CID1492867 Unchecked return value
>
> Sponsored-by: Sovereign Tech Fund
> Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> ---
> libavcodec/avs3_parser.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/avs3_parser.c b/libavcodec/avs3_parser.c
> index a819b5783d6..0f9076befe1 100644
> --- a/libavcodec/avs3_parser.c
> +++ b/libavcodec/avs3_parser.c
> @@ -73,7 +73,9 @@ static void parse_avs3_nal_units(AVCodecParserContext *s, const uint8_t *buf,
> GetBitContext gb;
> int profile, ratecode, low_delay;
>
> - init_get_bits8(&gb, buf + 4, buf_size - 4);
> + int ret = init_get_bits8(&gb, buf + 4, buf_size - 4);
> + if (ret < 0)
> + return;
>
> s->key_frame = 1;
> s->pict_type = AV_PICTURE_TYPE_I;
This code only reads/skips a few bits here (at most 100 if I counted
correctly), so one could initialize the reader for a shorter length and
assert that the call succeeds.
- Andreas
More information about the ffmpeg-devel
mailing list