diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2022-08-22 22:29:55 +0300 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2022-09-26 17:50:54 +0300 |
commit | 16d6003b32acfc87d8f882f404e4db71d006ec06 (patch) | |
tree | c7bae23342bd7184dac320b2d7648e36377a9fd5 | |
parent | d9c15655f9a080ea510e4a9e1942479f346e988d (diff) |
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 2200440e2c..3e6a9ca3d9 100644 --- a/libavcodec/midivid.c +++ b/libavcodec/midivid.c @@ -202,12 +202,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, 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); @@ -216,9 +211,13 @@ static int decode_frame(AVCodecContext *avctx, void *data, 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; |