comparison faxcompr.c @ 8486:87284151c592 libavcodec

Fix another sechole.
author michael
date Fri, 26 Dec 2008 17:51:10 +0000
parents 0ac984513c91
children 88e8b4f81275
comparison
equal deleted inserted replaced
8485:0ac984513c91 8486:87284151c592
121 initialized = 1; 121 initialized = 1;
122 } 122 }
123 123
124 124
125 static int decode_group3_1d_line(AVCodecContext *avctx, GetBitContext *gb, 125 static int decode_group3_1d_line(AVCodecContext *avctx, GetBitContext *gb,
126 int pix_left, int *runs, const int *runend) 126 unsigned int pix_left, int *runs, const int *runend)
127 { 127 {
128 int mode = 0, run = 0; 128 int mode = 0;
129 unsigned int run=0;
129 unsigned int t; 130 unsigned int t;
130 for(;;){ 131 for(;;){
131 t = get_vlc2(gb, ccitt_vlc[mode].table, 9, 2); 132 t = get_vlc2(gb, ccitt_vlc[mode].table, 9, 2);
132 run += t; 133 run += t;
133 if(t < 64){ 134 if(t < 64){
134 *runs++ = run; 135 *runs++ = run;
135 if(runs >= runend){ 136 if(runs >= runend){
136 av_log(avctx, AV_LOG_ERROR, "Run overrun\n"); 137 av_log(avctx, AV_LOG_ERROR, "Run overrun\n");
137 return -1; 138 return -1;
138 } 139 }
140 if(pix_left <= run){
141 if(pix_left == run)
142 break;
143 av_log(avctx, AV_LOG_ERROR, "Run went out of bounds\n");
144 return -1;
145 }
139 pix_left -= run; 146 pix_left -= run;
140 if(pix_left <= 0){
141 if(!pix_left)
142 break;
143 runs[-1] += pix_left;
144 av_log(avctx, AV_LOG_ERROR, "Run went out of bounds\n");
145 return -1;
146 }
147 run = 0; 147 run = 0;
148 mode = !mode; 148 mode = !mode;
149 }else if((int)t == -1){ 149 }else if((int)t == -1){
150 av_log(avctx, AV_LOG_ERROR, "Incorrect code\n"); 150 av_log(avctx, AV_LOG_ERROR, "Incorrect code\n");
151 return -1; 151 return -1;