Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com>
---
 libavcodec/ffv1dec.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index 45bfe21be5..791dc073bf 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -259,9 +259,17 @@ static int decode_slice(AVCodecContext *c, void *arg)
 
             if (fssrc->ac) {
                 pdst->state = av_malloc_array(CONTEXT_SIZE,  
psrc->context_count);
+                if (!pdst->state) {
+                    ret = AVERROR(ENOMEM);
+                    goto fail;
+                }
                 memcpy(pdst->state, psrc->state, CONTEXT_SIZE * 
psrc->context_count);
             } else {
                 pdst->vlc_state = av_malloc_array(sizeof(*pdst->vlc_state), 
psrc->context_count);
+                if (!pdst->vlc_state) {
+                    ret = AVERROR(ENOMEM);
+                    goto fail;
+                }
                 memcpy(pdst->vlc_state, psrc->vlc_state, 
sizeof(*pdst->vlc_state) * psrc->context_count);
             }
         }
@@ -343,6 +351,10 @@ static int decode_slice(AVCodecContext *c, void *arg)
     ff_thread_report_progress(&f->picture, si, 0);
 
     return 0;
+fail:
+    fs->slice_damaged = 1;
+    ff_thread_report_progress(&f->picture, si, 0);
+    return ret;
 }
 
 static int read_quant_table(RangeCoder *c, int16_t *quant_table, int scale)
-- 
2.27.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