Browse Source

libavcodec/exr : fix channel size calculation for uint32 channel

uint32 need 4 bytes not 1.
Fix decoding when there is half/float and uint32 channel.

This fixes crashes due to pointer corruption caused by invalid writes.

The problem was introduced in commit
03152e74df.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
(cherry picked from commit 52da3f6f70)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
tags/n3.2.1
Martin Vignali Andreas Cadhalpun 8 years ago
parent
commit
08f26d99b5
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      libavcodec/exr.c

+ 5
- 1
libavcodec/exr.c View File

@@ -1448,7 +1448,11 @@ static int decode_header(EXRContext *s)
channel->xsub = xsub; channel->xsub = xsub;
channel->ysub = ysub; channel->ysub = ysub;


s->current_channel_offset += 1 << current_pixel_type;
if (current_pixel_type == EXR_HALF) {
s->current_channel_offset += 2;
} else {/* Float or UINT32 */
s->current_channel_offset += 4;
}
} }


/* Check if all channels are set with an offset or if the channels /* Check if all channels are set with an offset or if the channels


Loading…
Cancel
Save