aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Vignali <martin.vignali@gmail.com>2016-11-16 23:15:27 +0100
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2016-11-17 23:37:05 +0100
commit08f26d99b52f05a605247a7b3b6507ae6b541ef0 (patch)
treedd0b314a04975e83a35c6e12c8f7fd4dbc03a07f
parentc7d38efbc26b36f445920c9e026923dd88eb2e6e (diff)
downloadffmpeg-08f26d99b52f05a605247a7b3b6507ae6b541ef0.tar.gz
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 03152e74dfdc7f438cb4a10402c4de744e807e22. Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> (cherry picked from commit 52da3f6f70b1e95589a152aaf224811756fb9665) Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
-rw-r--r--libavcodec/exr.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index 51a8ee603c..bc7e7218e0 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -1448,7 +1448,11 @@ static int decode_header(EXRContext *s)
channel->xsub = xsub;
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