shithub: aacenc

Download patch

ref: 648c55c5a0a049e557ac6d40ffe56ef49d4682a7
parent: ada4482ffa42204d7ad7b4f62e8c2adfc2095d5a
author: Krzysztof Nikiel <knik@users.sourceforge.net>
date: Sat Sep 2 16:05:48 EDT 2017

better framebuffer size check

--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,5 @@
 	* allowed even higher bitrates, including ADTS
+	* framebuffer size bug fixed
 	* removed broken object types: Main and LTP
 	* some mp4 atoms fixed for better compalibility
 	* stdin seek bug fixed
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 AC_PREREQ(2.50)
-AC_INIT(faac, 1.29.7.3, https://sourceforge.net/p/faac/bugs/)
+AC_INIT(faac, 1.29.7.4, https://sourceforge.net/p/faac/bugs/)
 AC_CONFIG_AUX_DIR(.)
 AM_INIT_AUTOMAKE([subdir-objects])
 
--- a/libfaac/bitstream.c
+++ b/libfaac/bitstream.c
@@ -316,9 +316,15 @@
     bits += ByteAlign(bitStream, 0, bits);
 
     hEncoder->usedBytes = bit2byte(bits);
-    if (hEncoder->usedBytes >= ADTS_FRAMESIZE)
+
+    if (hEncoder->usedBytes > bitStream->size)
     {
         fprintf(stderr, "frame buffer overrun\n");
+        return -1;
+    }
+    if (hEncoder->usedBytes >= ADTS_FRAMESIZE)
+    {
+        fprintf(stderr, "frame size limit exceeded\n");
         return -1;
     }