shithub: dav1d

Download patch

ref: 6153633dc641fec4f986bf3af10395b5328026c4
parent: ff2dcd6b596643c97fd8d4801bbcde94f01b6347
author: Derek Buitenhuis <derek.buitenhuis@gmail.com>
date: Tue Oct 2 09:36:45 EDT 2018

decode: Fix unchecked dav1d_alloc_aligned in decode_frame

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>

--- a/src/decode.c
+++ b/src/decode.c
@@ -2324,6 +2324,12 @@
         uint16_t *lr_ptr = f->lf.lr_lpf_line =
             dav1d_alloc_aligned(f->b4_stride * 4 * 3 * 12 * sizeof(uint16_t), 32);
 
+        if (!ptr || !lr_ptr) {
+            if (ptr) dav1d_free_aligned(ptr);
+            if (lr_ptr) dav1d_free_aligned(lr_ptr);
+            return -ENOMEM;
+        }
+
         for (int pl = 0; pl <= 2; pl++) {
             f->lf.cdef_line_ptr[0][pl][0] = ptr + f->b4_stride * 4 * 0;
             f->lf.cdef_line_ptr[0][pl][1] = ptr + f->b4_stride * 4 * 1;