diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-08-12 05:32:07 +0200 |
---|---|---|
committer | Vittorio Giovara <vittorio.giovara@gmail.com> | 2014-04-01 01:13:18 +0200 |
commit | 0279d1d0946a854aa08919abd05b7f2da433823e (patch) | |
tree | 5e7376cb2d1b71feee327163b125a05534e37585 /libavcodec | |
parent | e7cd53bf662a93330810981f1d057bdf2ead669e (diff) | |
download | ffmpeg-0279d1d0946a854aa08919abd05b7f2da433823e.tar.gz |
sgi: fix end of line boundary detection
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/sgidec.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libavcodec/sgidec.c b/libavcodec/sgidec.c index 91b68eb9f7..112a18159b 100644 --- a/libavcodec/sgidec.c +++ b/libavcodec/sgidec.c @@ -48,13 +48,14 @@ static int expand_rle_row(SgiState *s, uint8_t *out_buf, { unsigned char pixel, count; unsigned char *orig = out_buf; + uint8_t *out_end = out_buf + len; - 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. */ @@ -77,6 +78,7 @@ static int expand_rle_row(SgiState *s, uint8_t *out_buf, } } } + return (out_buf - orig) / pixelstride; } /** |