diff options
author | Paul B Mahol <onemda@gmail.com> | 2012-07-13 02:02:10 +0000 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2012-07-16 00:39:37 +0000 |
commit | 7543fd80e5c24aa835e4bcf5d8ef02b18f242018 (patch) | |
tree | 2bc28e8f72c9657f1f08cdd38da3ce2f816555c2 | |
parent | 8b855b69a179ee262f214e862f82f6e7d6f53156 (diff) | |
download | ffmpeg-7543fd80e5c24aa835e4bcf5d8ef02b18f242018.tar.gz |
exr: check size of uncompressed buffer returned by uncompress()
The actual size of uncompressed buffer returned by uncompress() may be
smaller than expected, so abort decoding in such cases.
Signed-off-by: Paul B Mahol <onemda@gmail.com>
-rw-r--r-- | libavcodec/exr.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/exr.c b/libavcodec/exr.c index 52e8916796..f175706a3d 100644 --- a/libavcodec/exr.c +++ b/libavcodec/exr.c @@ -545,7 +545,10 @@ static int decode_frame(AVCodecContext *avctx, const uint8_t *red_channel_buffer, *green_channel_buffer, *blue_channel_buffer, *alpha_channel_buffer = 0; if ((s->compr == EXR_ZIP1 || s->compr == EXR_ZIP16) && data_size < uncompressed_size) { - if (uncompress(s->tmp, &uncompressed_size, avpkt->data + line_offset, data_size) != Z_OK) { + unsigned long dest_len = uncompressed_size; + + if (uncompress(s->tmp, &dest_len, avpkt->data + line_offset, data_size) != Z_OK || + dest_len != uncompressed_size) { av_log(avctx, AV_LOG_ERROR, "error during zlib decompression\n"); return AVERROR(EINVAL); } |