changeset 596:01da62a51ce8 libavcodec

hopefully fixing unreprodceable segfault when overreading the end if error_resilience==-1 (it didnt overread here though)
author michaelni
date Sun, 04 Aug 2002 19:28:27 +0000
parents 5f7ab2e73bc9
children d5d0c11ea4cf
files msmpeg4.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/msmpeg4.c	Sun Aug 04 18:19:09 2002 +0000
+++ b/msmpeg4.c	Sun Aug 04 19:28:27 2002 +0000
@@ -1859,7 +1859,8 @@
         if (i > 62){
             i-= 192;
             if(i&(~63)){
-                if((i+192 == 64 && level/qmul==-1) || s->error_resilience<0){
+                const int left= s->gb.size*8 - get_bits_count(&s->gb);
+                if(((i+192 == 64 && level/qmul==-1) || s->error_resilience<0) && left>=0){
                     fprintf(stderr, "ignoring overflow at %d %d\n", s->mb_x, s->mb_y);
                     break;
                 }else{