changeset 8486:87284151c592 libavcodec

Fix another sechole.
author michael
date Fri, 26 Dec 2008 17:51:10 +0000
parents 0ac984513c91
children 88e8b4f81275
files faxcompr.c
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/faxcompr.c	Fri Dec 26 17:32:11 2008 +0000
+++ b/faxcompr.c	Fri Dec 26 17:51:10 2008 +0000
@@ -123,9 +123,10 @@
 
 
 static int decode_group3_1d_line(AVCodecContext *avctx, GetBitContext *gb,
-                                 int pix_left, int *runs, const int *runend)
+                                 unsigned int pix_left, int *runs, const int *runend)
 {
-    int mode = 0, run = 0;
+    int mode = 0;
+    unsigned int run=0;
     unsigned int t;
     for(;;){
         t = get_vlc2(gb, ccitt_vlc[mode].table, 9, 2);
@@ -136,14 +137,13 @@
                 av_log(avctx, AV_LOG_ERROR, "Run overrun\n");
                 return -1;
             }
-            pix_left -= run;
-            if(pix_left <= 0){
-                if(!pix_left)
+            if(pix_left <= run){
+                if(pix_left == run)
                     break;
-                runs[-1] += pix_left;
                 av_log(avctx, AV_LOG_ERROR, "Run went out of bounds\n");
                 return -1;
             }
+            pix_left -= run;
             run = 0;
             mode = !mode;
         }else if((int)t == -1){