shithub: dav1d

Download patch

ref: c1a28d0e008cfa494c45bce973270d71c256fe5d
parent: 0435ec9cef090d42768cf26daa2a7ab58dd30719
author: Henrik Gramner <gramner@twoorioles.com>
date: Fri Jul 5 16:36:09 EDT 2019

Correctly return an error on malloc failure

dav1d_submit_frame() could erroneously return 0 when tile data memory
allocation failed.

Fixes an assertion failure in dav1d_parse_obus().

--- a/src/decode.c
+++ b/src/decode.c
@@ -3241,7 +3241,10 @@
         freep(&f->tile);
         assert(c->n_tile_data < INT_MAX / (int)sizeof(*f->tile));
         f->tile = malloc(c->n_tile_data * sizeof(*f->tile));
-        if (!f->tile) goto error;
+        if (!f->tile) {
+            res = DAV1D_ERR(ENOMEM);
+            goto error;
+        }
         f->n_tile_data_alloc = c->n_tile_data;
     }
     memcpy(f->tile, c->tile, c->n_tile_data * sizeof(*f->tile));