diff mbox series

[FFmpeg-devel,15/18] avcodec/hevcdec: Check allocation

Message ID DB6PR0101MB221470B75F79236AEEFF5C2A8FBA9@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com
State Accepted
Commit db99ca21500534d1ca3eecc1039f1f45394569e1
Headers show
Series [FFmpeg-devel,v2,01/18] avcodec/pthread_slice: Don't reinitialise initialised mutex | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt June 30, 2022, 10:29 p.m. UTC
Also postpone it after the checks for invalid input.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/hevcdec.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 048fcc76b4..5215f06e31 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -2645,8 +2645,6 @@  static int hls_slice_data_wpp(HEVCContext *s, const H2645NAL *nal)
         goto error;
     }
 
-    ff_alloc_entries(s->avctx, s->sh.num_entry_point_offsets + 1);
-
     for (i = 1; i < s->threads_number; i++) {
         if (s->HEVClcList[i])
             continue;
@@ -2700,6 +2698,9 @@  static int hls_slice_data_wpp(HEVCContext *s, const H2645NAL *nal)
     }
 
     atomic_store(&s->wpp_err, 0);
+    res = ff_alloc_entries(s->avctx, s->sh.num_entry_point_offsets + 1);
+    if (res < 0)
+        goto error;
     ff_reset_entries(s->avctx);
 
     for (i = 0; i <= s->sh.num_entry_point_offsets; i++) {