Message ID | 20230807004949.31634-5-michael@niedermayer.cc |
---|---|
State | Accepted |
Commit | 5f5a1ccd04acc74e31e1e4fe7e297b3f589425b3 |
Headers | show |
Series | [FFmpeg-devel,1/5] avcodec/mv30: Allocate frame later | expand |
Context | Check | Description |
---|---|---|
yinshiyou/make_loongarch64 | success | Make finished |
yinshiyou/make_fate_loongarch64 | success | Make fate finished |
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
diff --git a/libavcodec/wavarc.c b/libavcodec/wavarc.c index 0dc5849679..4bdd548d5f 100644 --- a/libavcodec/wavarc.c +++ b/libavcodec/wavarc.c @@ -311,7 +311,7 @@ static int decode_2slp(AVCodecContext *avctx, return AVERROR_EOF; case 8: s->nb_samples = get_urice(gb, 8); - if (s->nb_samples > 570) { + if (s->nb_samples > 570U) { s->nb_samples = 570; return AVERROR_INVALIDDATA; } @@ -587,7 +587,7 @@ static int decode_5elp(AVCodecContext *avctx, return AVERROR_EOF; case 11: s->nb_samples = get_urice(gb, 8); - if (s->nb_samples > 570) { + if (s->nb_samples > 570U) { s->nb_samples = 570; return AVERROR_INVALIDDATA; }
It is currently probably not possible for it to be negative as the needed 2Mb input buf size is not achievable. But it is more robust to check for it too. If it would become negative than code like s->samples[0][n] = s->samples[0][s->nb_samples + n]; would crash Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> --- libavcodec/wavarc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)