diff mbox

[FFmpeg-devel,1/6] avcodec/rv10: Avoid calculating undefined value that is unused

Message ID 20190616174850.31656-1-michael@niedermayer.cc
State Accepted
Commit d57f6606ebe166a428d939228d0d6490e3255ae1
Headers show

Commit Message

Michael Niedermayer June 16, 2019, 5:48 p.m. UTC
Fixes: shift exponent 64 is too large for 32-bit type 'int'
Fixes: 15253/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RV10_fuzzer-5671114300194816

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/rv10.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer June 26, 2019, 7:29 p.m. UTC | #1
On Sun, Jun 16, 2019 at 07:48:45PM +0200, Michael Niedermayer wrote:
> Fixes: shift exponent 64 is too large for 32-bit type 'int'
> Fixes: 15253/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RV10_fuzzer-5671114300194816
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/rv10.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply patchset

[...]
diff mbox

Patch

diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c
index 595e217519..8f4497b9e0 100644
--- a/libavcodec/rv10.c
+++ b/libavcodec/rv10.c
@@ -646,7 +646,7 @@  static int rv10_decode_packet(AVCodecContext *avctx, const uint8_t *buf,
 
         // Repeat the slice end check from ff_h263_decode_mb with our active
         // bitstream size
-        if (ret != SLICE_ERROR) {
+        if (ret != SLICE_ERROR && active_bits_size >= get_bits_count(&s->gb)) {
             int v = show_bits(&s->gb, 16);
 
             if (get_bits_count(&s->gb) + 16 > active_bits_size)