Mercurial > libavcodec.hg
comparison faxcompr.c @ 8487:88e8b4f81275 libavcodec
Fix yet another sechole.
author | michael |
---|---|
date | Fri, 26 Dec 2008 18:06:29 +0000 |
parents | 87284151c592 |
children | f2590c8d5e9b |
comparison
equal
deleted
inserted
replaced
8486:87284151c592 | 8487:88e8b4f81275 |
---|---|
154 *runs++ = 0; | 154 *runs++ = 0; |
155 return 0; | 155 return 0; |
156 } | 156 } |
157 | 157 |
158 static int decode_group3_2d_line(AVCodecContext *avctx, GetBitContext *gb, | 158 static int decode_group3_2d_line(AVCodecContext *avctx, GetBitContext *gb, |
159 int width, int *runs, const int *runend, const int *ref) | 159 unsigned int width, int *runs, const int *runend, const int *ref) |
160 { | 160 { |
161 int mode = 0, offs = 0, run = 0, saved_run = 0, t; | 161 int mode = 0, saved_run = 0, t; |
162 int run_off = *ref++; | 162 int run_off = *ref++; |
163 unsigned int offs=0, run= 0; | |
163 | 164 |
164 runend--; // for the last written 0 | 165 runend--; // for the last written 0 |
165 | 166 |
166 while(offs < width){ | 167 while(offs < width){ |
167 int cmode = get_vlc2(gb, ccitt_group3_2d_vlc.table, 9, 1); | 168 int cmode = get_vlc2(gb, ccitt_group3_2d_vlc.table, 9, 1); |
198 av_log(avctx, AV_LOG_ERROR, "Run overrun\n"); | 199 av_log(avctx, AV_LOG_ERROR, "Run overrun\n"); |
199 return -1; | 200 return -1; |
200 } | 201 } |
201 saved_run = 0; | 202 saved_run = 0; |
202 offs += run; | 203 offs += run; |
203 if(offs > width){ | 204 if(offs > width || run > width){ |
204 av_log(avctx, AV_LOG_ERROR, "Run went out of bounds\n"); | 205 av_log(avctx, AV_LOG_ERROR, "Run went out of bounds\n"); |
205 return -1; | 206 return -1; |
206 } | 207 } |
207 mode = !mode; | 208 mode = !mode; |
208 } | 209 } |