diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2022-08-22 21:29:55 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2022-08-28 23:07:06 +0200 |
commit | 550fd2212df136f72b0d7c34190320ff7b9d299c (patch) | |
tree | 1d439f2ba411bdb6799b74e23dd2eaba4306e883 | |
parent | 1cd07b178b02614b1f13e8b9f15c13edf3dbdf90 (diff) | |
download | ffmpeg-550fd2212df136f72b0d7c34190320ff7b9d299c.tar.gz |
avcodec/midivid: Perform lzss_uncompress() before ff_reget_buffer()
This would avoid regeting the frame on lzss errors
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 628fb97efb0b6202e56fab89670406261bf86d85)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/midivid.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/libavcodec/midivid.c b/libavcodec/midivid.c index a21303ab60..e356fda760 100644 --- a/libavcodec/midivid.c +++ b/libavcodec/midivid.c @@ -203,12 +203,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe, bytestream2_skip(gb, 8); uncompressed = bytestream2_get_le32(gb); - if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0) - return ret; - - if (uncompressed) { - ret = decode_mvdv(s, avctx, frame); - } else { + if (!uncompressed) { av_fast_padded_malloc(&s->uncompressed, &s->uncompressed_size, 16LL * (avpkt->size - 12)); if (!s->uncompressed) return AVERROR(ENOMEM); @@ -217,9 +212,13 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe, if (ret < 0) return ret; bytestream2_init(gb, s->uncompressed, ret); - ret = decode_mvdv(s, avctx, frame); } + if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0) + return ret; + + ret = decode_mvdv(s, avctx, frame); + if (ret < 0) return ret; key = ret; |