summaryrefslogtreecommitdiff
path: root/libavcodec/faxcompr.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-12-24 04:35:12 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-12-24 04:35:12 +0100
commit98b7a50a2100e3dad96821d2c0adac369652707d (patch)
tree947f0d2371a11f9d029531e17e98977537bcb888 /libavcodec/faxcompr.c
parentd4d8d4f786d9c13b760403d96fe8868d1354b01c (diff)
downloadffmpeg-98b7a50a2100e3dad96821d2c0adac369652707d.tar.gz
tiffdec: Fix runend handling
Fixes Ticket1999 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/faxcompr.c')
-rw-r--r--libavcodec/faxcompr.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/libavcodec/faxcompr.c b/libavcodec/faxcompr.c
index e7f9d00a11..3e51a3e793 100644
--- a/libavcodec/faxcompr.c
+++ b/libavcodec/faxcompr.c
@@ -163,8 +163,6 @@ static int decode_group3_2d_line(AVCodecContext *avctx, GetBitContext *gb,
int run_off = *ref++;
unsigned int offs=0, run= 0;
- runend--; // for the last written 0
-
while(offs < width){
int cmode = get_vlc2(gb, ccitt_group3_2d_vlc.table, 9, 1);
if(cmode == -1){
@@ -234,7 +232,13 @@ static int decode_group3_2d_line(AVCodecContext *avctx, GetBitContext *gb,
}
}
*runs++ = saved_run;
- *runs++ = 0;
+ if (saved_run) {
+ if(runs >= runend){
+ av_log(avctx, AV_LOG_ERROR, "Run overrun\n");
+ return -1;
+ }
+ *runs++ = 0;
+ }
return 0;
}