aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/sgidec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-10-23 01:40:57 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-10-23 02:49:45 +0200
commit60ea0a5236ceac03b8d3ab3b73bda04d04c17273 (patch)
tree810641d11e003dfd211ddd6622d099d6ca3aa73a /libavcodec/sgidec.c
parent610a8b1537fe728f4f1e44a5276f225334653123 (diff)
downloadandroid_external_ffmpeg-60ea0a5236ceac03b8d3ab3b73bda04d04c17273.tar.gz
android_external_ffmpeg-60ea0a5236ceac03b8d3ab3b73bda04d04c17273.tar.bz2
android_external_ffmpeg-60ea0a5236ceac03b8d3ab3b73bda04d04c17273.zip
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>
Diffstat (limited to 'libavcodec/sgidec.c')
-rw-r--r--libavcodec/sgidec.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/libavcodec/sgidec.c b/libavcodec/sgidec.c
index df41e89853..e373825ba8 100644
--- a/libavcodec/sgidec.c
+++ b/libavcodec/sgidec.c
@@ -138,10 +138,9 @@ static int read_uncompressed_sgi(unsigned char* out_buf, SgiState *s)
for (y = s->height - 1; y >= 0; y--) {
out_end = out_buf + (y * s->linesize);
if (s->bytes_per_channel == 1) {
- for (x = s->width; x > 0; x--) {
- bytestream2_get_bufferu(&gp[z], out_end, s->depth);
- out_end += s->depth;
- }
+ for (x = s->width; x > 0; x--)
+ for (z = 0; z < s->depth; z++)
+ *out_end++ = bytestream2_get_byteu(&gp[z]);
} else {
uint16_t *out16 = (uint16_t *)out_end;
for (x = s->width; x > 0; x--)