1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avcodec/sgi: Fix dereferencing uninitialized pointer

This also fixes the code so it decodes raw images correctly again
No release is affected by this

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2013-10-23 01:40:57 +02:00
parent 610a8b1537
commit 60ea0a5236

View File

@ -138,10 +138,9 @@ static int read_uncompressed_sgi(unsigned char* out_buf, SgiState *s)
for (y = s->height - 1; y >= 0; y--) { for (y = s->height - 1; y >= 0; y--) {
out_end = out_buf + (y * s->linesize); out_end = out_buf + (y * s->linesize);
if (s->bytes_per_channel == 1) { if (s->bytes_per_channel == 1) {
for (x = s->width; x > 0; x--) { for (x = s->width; x > 0; x--)
bytestream2_get_bufferu(&gp[z], out_end, s->depth); for (z = 0; z < s->depth; z++)
out_end += s->depth; *out_end++ = bytestream2_get_byteu(&gp[z]);
}
} else { } else {
uint16_t *out16 = (uint16_t *)out_end; uint16_t *out16 = (uint16_t *)out_end;
for (x = s->width; x > 0; x--) for (x = s->width; x > 0; x--)