aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/sgidec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-08-12 05:32:07 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-08-12 05:32:07 +0200
commit6fd7bf7b03c068d0f91de03bdd9b4e91695680eb (patch)
treeeeccf1eeb0410baa5f584fbbfe1acf2069b5e332 /libavcodec/sgidec.c
parent39c56ef9216c508a2c19cef93600e6590b4595cd (diff)
downloadandroid_external_ffmpeg-6fd7bf7b03c068d0f91de03bdd9b4e91695680eb.tar.gz
android_external_ffmpeg-6fd7bf7b03c068d0f91de03bdd9b4e91695680eb.tar.bz2
android_external_ffmpeg-6fd7bf7b03c068d0f91de03bdd9b4e91695680eb.zip
sgidec: fix error free end detection.
Fixes Ticket1506 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/sgidec.c')
-rw-r--r--libavcodec/sgidec.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/sgidec.c b/libavcodec/sgidec.c
index e9d7731e9a..370473af7d 100644
--- a/libavcodec/sgidec.c
+++ b/libavcodec/sgidec.c
@@ -49,12 +49,12 @@ static int expand_rle_row(SgiState *s, uint8_t *out_buf,
unsigned char pixel, count;
unsigned char *orig = out_buf;
- while (1) {
+ while (out_buf < out_end) {
if (bytestream2_get_bytes_left(&s->g) < 1)
return AVERROR_INVALIDDATA;
pixel = bytestream2_get_byteu(&s->g);
if (!(count = (pixel & 0x7f))) {
- return (out_buf - orig) / pixelstride;
+ break;
}
/* Check for buffer overflow. */
@@ -74,6 +74,7 @@ static int expand_rle_row(SgiState *s, uint8_t *out_buf,
}
}
}
+ return (out_buf - orig) / pixelstride;
}
/**