aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/vmdav.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-06-03 12:33:00 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-06-03 12:33:00 +0200
commit5c43f3ddea40fc76264d647750f6986a9247aead (patch)
treed8ff70695eac396f832704edfa3c1083080677b7 /libavcodec/vmdav.c
parentc3660c361822ffa9ae4fc47f655adab52a0f3c57 (diff)
parent31980b6abdd8ffb6953472a7a6b59f3aa5762c31 (diff)
downloadffmpeg-5c43f3ddea40fc76264d647750f6986a9247aead.tar.gz
Merge commit '31980b6abdd8ffb6953472a7a6b59f3aa5762c31'
* commit '31980b6abdd8ffb6953472a7a6b59f3aa5762c31': vmd: decode videos with no LZ buffer size provided - they might not need it Conflicts: libavcodec/vmdav.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/vmdav.c')
-rw-r--r--libavcodec/vmdav.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/libavcodec/vmdav.c b/libavcodec/vmdav.c
index d32947d39b..846d7c299e 100644
--- a/libavcodec/vmdav.c
+++ b/libavcodec/vmdav.c
@@ -279,6 +279,11 @@ static int vmd_decode(VmdVideoContext *s, AVFrame *frame)
return AVERROR_INVALIDDATA;
meth = bytestream2_get_byteu(&gb);
if (meth & 0x80) {
+ if (!s->unpack_buffer_size) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "Trying to unpack LZ-compressed frame with no LZ buffer\n");
+ return AVERROR_INVALIDDATA;
+ }
lz_unpack(gb.buffer, bytestream2_get_bytes_left(&gb),
s->unpack_buffer, s->unpack_buffer_size);
meth &= 0x7F;
@@ -390,9 +395,11 @@ static av_cold int vmdvideo_decode_init(AVCodecContext *avctx)
vmd_header = (unsigned char *)avctx->extradata;
s->unpack_buffer_size = AV_RL32(&vmd_header[800]);
- s->unpack_buffer = av_malloc(s->unpack_buffer_size);
- if (!s->unpack_buffer)
- return AVERROR(ENOMEM);
+ if (s->unpack_buffer_size) {
+ s->unpack_buffer = av_malloc(s->unpack_buffer_size);
+ if (!s->unpack_buffer)
+ return AVERROR(ENOMEM);
+ }
/* load up the initial palette */
raw_palette = &vmd_header[28];