Commit 5c43f3dd authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '31980b6a'

* commit '31980b6a':
  vmd: decode videos with no LZ buffer size provided - they might not need it

Conflicts:
	libavcodec/vmdav.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents c3660c36 31980b6a
...@@ -279,6 +279,11 @@ static int vmd_decode(VmdVideoContext *s, AVFrame *frame) ...@@ -279,6 +279,11 @@ static int vmd_decode(VmdVideoContext *s, AVFrame *frame)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
meth = bytestream2_get_byteu(&gb); meth = bytestream2_get_byteu(&gb);
if (meth & 0x80) { 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), lz_unpack(gb.buffer, bytestream2_get_bytes_left(&gb),
s->unpack_buffer, s->unpack_buffer_size); s->unpack_buffer, s->unpack_buffer_size);
meth &= 0x7F; meth &= 0x7F;
...@@ -390,9 +395,11 @@ static av_cold int vmdvideo_decode_init(AVCodecContext *avctx) ...@@ -390,9 +395,11 @@ static av_cold int vmdvideo_decode_init(AVCodecContext *avctx)
vmd_header = (unsigned char *)avctx->extradata; vmd_header = (unsigned char *)avctx->extradata;
s->unpack_buffer_size = AV_RL32(&vmd_header[800]); s->unpack_buffer_size = AV_RL32(&vmd_header[800]);
s->unpack_buffer = av_malloc(s->unpack_buffer_size); if (s->unpack_buffer_size) {
if (!s->unpack_buffer) s->unpack_buffer = av_malloc(s->unpack_buffer_size);
return AVERROR(ENOMEM); if (!s->unpack_buffer)
return AVERROR(ENOMEM);
}
/* load up the initial palette */ /* load up the initial palette */
raw_palette = &vmd_header[28]; raw_palette = &vmd_header[28];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment