Message ID | 20240502004150.3627661-4-michael@niedermayer.cc |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel,1/7] avcodec/av1dec: bit_depth cannot be another values than 8, 10, 12 | expand |
Michael Niedermayer: > Fixes: CID1506708 Unchecked return value > > Sponsored-by: Sovereign Tech Fund > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> > --- > libavcodec/avs2_parser.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/libavcodec/avs2_parser.c b/libavcodec/avs2_parser.c > index 200134f91db..8d4bc3cee0d 100644 > --- a/libavcodec/avs2_parser.c > +++ b/libavcodec/avs2_parser.c > @@ -72,13 +72,15 @@ static void parse_avs2_seq_header(AVCodecParserContext *s, const uint8_t *buf, > unsigned aspect_ratio; > unsigned frame_rate_code; > int low_delay; > + int ret; > // update buf_size_min if parse more deeper > const int buf_size_min = 15; > > if (buf_size < buf_size_min) > return; > > - init_get_bits8(&gb, buf, buf_size_min); > + ret = init_get_bits8(&gb, buf, buf_size_min); > + av_assert2(ret >= 0); > > s->key_frame = 1; > s->pict_type = AV_PICTURE_TYPE_I; Code like this may trigger set-but-unused variable warnings when ASSERT_LEVEL is <= 1. Add av_unused to ret to fix this. Apart from that, it should be av_assert1 (this is not hot). - Andreas
On Thu, May 02, 2024 at 10:25:24AM +0200, Andreas Rheinhardt wrote: > Michael Niedermayer: > > Fixes: CID1506708 Unchecked return value > > > > Sponsored-by: Sovereign Tech Fund > > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> > > --- > > libavcodec/avs2_parser.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/libavcodec/avs2_parser.c b/libavcodec/avs2_parser.c > > index 200134f91db..8d4bc3cee0d 100644 > > --- a/libavcodec/avs2_parser.c > > +++ b/libavcodec/avs2_parser.c > > @@ -72,13 +72,15 @@ static void parse_avs2_seq_header(AVCodecParserContext *s, const uint8_t *buf, > > unsigned aspect_ratio; > > unsigned frame_rate_code; > > int low_delay; > > + int ret; > > // update buf_size_min if parse more deeper > > const int buf_size_min = 15; > > > > if (buf_size < buf_size_min) > > return; > > > > - init_get_bits8(&gb, buf, buf_size_min); > > + ret = init_get_bits8(&gb, buf, buf_size_min); > > + av_assert2(ret >= 0); > > > > s->key_frame = 1; > > s->pict_type = AV_PICTURE_TYPE_I; > > Code like this may trigger set-but-unused variable warnings when > ASSERT_LEVEL is <= 1. Add av_unused to ret to fix this. > Apart from that, it should be av_assert1 (this is not hot). will apply with these changes thx [...]
diff --git a/libavcodec/avs2_parser.c b/libavcodec/avs2_parser.c index 200134f91db..8d4bc3cee0d 100644 --- a/libavcodec/avs2_parser.c +++ b/libavcodec/avs2_parser.c @@ -72,13 +72,15 @@ static void parse_avs2_seq_header(AVCodecParserContext *s, const uint8_t *buf, unsigned aspect_ratio; unsigned frame_rate_code; int low_delay; + int ret; // update buf_size_min if parse more deeper const int buf_size_min = 15; if (buf_size < buf_size_min) return; - init_get_bits8(&gb, buf, buf_size_min); + ret = init_get_bits8(&gb, buf, buf_size_min); + av_assert2(ret >= 0); s->key_frame = 1; s->pict_type = AV_PICTURE_TYPE_I;
Fixes: CID1506708 Unchecked return value Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> --- libavcodec/avs2_parser.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)