shithub: aacdec

Download patch

ref: 1b71a6ba963d131375f5e489b3b25e36f19f3f24
parent: 1073aeef823cafd844704389e9a497c257768e2f
author: Fabian Greffrath <[email protected]>
date: Mon Aug 31 06:00:37 EDT 2020

fix heap-buffer-overflow in mp4read.c

This originated from an integer overflow: If mp4config.frame.ents
would be read-in with a value of (uint32t)(-1), it would overflow to 0
in the size calculation for the allocation in the next line. The
malloc() function would then successfully return a pointer to a memory
region of size 0, which will cause a segfault when written to.

Fixes #57.

--- a/frontend/mp4read.c
+++ b/frontend/mp4read.c
@@ -344,7 +344,10 @@
     u32in();
     // Number of entries
     mp4config.frame.ents = u32in();
-    // fixme: check atom size
+
+    if (!(mp4config.frame.ents + 1))
+        return ERR_FAIL;
+
     mp4config.frame.data = malloc(sizeof(*mp4config.frame.data)
                                   * (mp4config.frame.ents + 1));