Signed-off-by: James Almer <jamr...@gmail.com>
---
This is an alternative approach to "avcodec/nuv: Avoid duplicating frames",
similar to the one from "avcodec/qtrle: call ff_reget_buffer() only when the
picture data is going to change", to workaround fuzzer reported timeouts but
without changing the behavior of the decoder.

 libavcodec/nuv.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/libavcodec/nuv.c b/libavcodec/nuv.c
index 75b14bce5b..4b171fde36 100644
--- a/libavcodec/nuv.c
+++ b/libavcodec/nuv.c
@@ -268,7 +268,15 @@ retry:
         init_frame = 1;
     }
 
-    if ((result = ff_reget_buffer(avctx, c->pic)) < 0)
+    if (comptype == NUV_COPY_LAST) {
+        if (!c->pic->data[0])
+            return AVERROR_INVALIDDATA;
+        // ff_reget_buffer() isn't needed when frames don't change, so just 
update
+        // frame props.
+        ret = ff_decode_frame_props(avctx, c->pic);
+        if (ret < 0)
+            return ret;
+    } else if ((result = ff_reget_buffer(avctx, c->pic)) < 0)
         return result;
     if (init_frame) {
         memset(c->pic->data[0], 0,    avctx->height * c->pic->linesize[0]);
-- 
2.22.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to