[FFmpeg-devel] [PATCH 3/3 v2] FATE/bprint: Convert a VLA to a normal array

Derek Buitenhuis derek.buitenhuis at gmail.com
Tue Sep 11 23:23:47 CEST 2012


Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>
---
 libavutil/bprint.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavutil/bprint.c b/libavutil/bprint.c
index 6e59f6b..08231d2 100644
--- a/libavutil/bprint.c
+++ b/libavutil/bprint.c
@@ -21,6 +21,7 @@
 #include <stdarg.h>
 #include <stdio.h>
 #include <string.h>
+#include "avassert.h"
 #include "bprint.h"
 #include "common.h"
 #include "error.h"
@@ -189,7 +190,10 @@ int av_bprint_finalize(AVBPrint *buf, char **ret_str)
 
 static void bprint_pascal(AVBPrint *b, unsigned size)
 {
-    unsigned p[size + 1], i, j;
+    unsigned i, j;
+    unsigned p[42];
+
+    av_assert0(size < FF_ARRAY_ELEMS(p));
 
     p[0] = 1;
     av_bprintf(b, "%8d\n", 1);
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list