diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c
index 7764c351815c810beb0edc1e2acedd3979526689..f5125b694ea721a7ccc50095c145d854d0ccafb6 100644
--- a/libavcodec/huffyuv.c
+++ b/libavcodec/huffyuv.c
@@ -232,9 +232,9 @@ static void heap_sift(HeapElem *h, int root, int size)
 }
 
 static void generate_len_table(uint8_t *dst, const uint64_t *stats, int size){
-    HeapElem h[size];
-    int up[2*size];
-    int len[2*size];
+    HeapElem h[256];
+    int up[2*256];
+    int len[2*256];
     int offset, i, next;
 
     for(offset=1; ; offset<<=1){