Commit 0279d1d0 authored by Michael Niedermayer's avatar Michael Niedermayer Committed by Vittorio Giovara

sgi: fix end of line boundary detection

parent e7cd53bf
......@@ -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;
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment