mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-04-14 00:58:38 +02:00
sgidec: fix error free end detection.
Fixes Ticket1506 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
39c56ef921
commit
6fd7bf7b03
@ -49,12 +49,12 @@ static int expand_rle_row(SgiState *s, uint8_t *out_buf,
|
|||||||
unsigned char pixel, count;
|
unsigned char pixel, count;
|
||||||
unsigned char *orig = out_buf;
|
unsigned char *orig = out_buf;
|
||||||
|
|
||||||
while (1) {
|
while (out_buf < out_end) {
|
||||||
if (bytestream2_get_bytes_left(&s->g) < 1)
|
if (bytestream2_get_bytes_left(&s->g) < 1)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
pixel = bytestream2_get_byteu(&s->g);
|
pixel = bytestream2_get_byteu(&s->g);
|
||||||
if (!(count = (pixel & 0x7f))) {
|
if (!(count = (pixel & 0x7f))) {
|
||||||
return (out_buf - orig) / pixelstride;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for buffer overflow. */
|
/* Check for buffer overflow. */
|
||||||
@ -74,6 +74,7 @@ static int expand_rle_row(SgiState *s, uint8_t *out_buf,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return (out_buf - orig) / pixelstride;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user