M4X4 opcode can actually overflow some string buffers.
authorRyan C. Gordon <icculus@icculus.org>
Fri, 13 Apr 2012 16:10:48 -0400
changeset 1080 b92bdbf78621
parent 1079 a9a27872b73c
child 1081 0318ad91ed5d
M4X4 opcode can actually overflow some string buffers.
mojoshader.c
mojoshader_common.c
--- a/mojoshader.c	Fri Apr 13 02:13:47 2012 -0400
+++ b/mojoshader.c	Fri Apr 13 16:10:48 2012 -0400
@@ -1811,7 +1811,7 @@
         return buf;
     } // if
 
-    char operation[128];
+    char operation[256];
     va_list ap;
     va_start(ap, fmt);
     const int len = vsnprintf(operation, sizeof (operation), fmt, ap);
@@ -2830,7 +2830,7 @@
     char row1[64]; make_GLSL_srcarg_string_full(ctx, 2, row1, sizeof (row1));
     char row2[64]; make_GLSL_srcarg_string_full(ctx, 3, row2, sizeof (row2));
     char row3[64]; make_GLSL_srcarg_string_full(ctx, 4, row3, sizeof (row3));
-    char code[128];
+    char code[256];
     make_GLSL_destarg_assign(ctx, code, sizeof (code),
                     "vec4(dot(%s, %s), dot(%s, %s), dot(%s, %s), dot(%s, %s))",
                     src0, row0, src0, row1, src0, row2, src0, row3);
@@ -2843,7 +2843,7 @@
     char row0[64]; make_GLSL_srcarg_string_full(ctx, 1, row0, sizeof (row0));
     char row1[64]; make_GLSL_srcarg_string_full(ctx, 2, row1, sizeof (row1));
     char row2[64]; make_GLSL_srcarg_string_full(ctx, 3, row2, sizeof (row2));
-    char code[128];
+    char code[256];
     make_GLSL_destarg_assign(ctx, code, sizeof (code),
                                 "vec3(dot(%s, %s), dot(%s, %s), dot(%s, %s))",
                                 src0, row0, src0, row1, src0, row2);
@@ -2858,7 +2858,7 @@
     char row2[64]; make_GLSL_srcarg_string_vec3(ctx, 3, row2, sizeof (row2));
     char row3[64]; make_GLSL_srcarg_string_vec3(ctx, 4, row3, sizeof (row3));
 
-    char code[128];
+    char code[256];
     make_GLSL_destarg_assign(ctx, code, sizeof (code),
                                 "vec4(dot(%s, %s), dot(%s, %s), "
                                      "dot(%s, %s), dot(%s, %s))",
@@ -2873,7 +2873,7 @@
     char row0[64]; make_GLSL_srcarg_string_vec3(ctx, 1, row0, sizeof (row0));
     char row1[64]; make_GLSL_srcarg_string_vec3(ctx, 2, row1, sizeof (row1));
     char row2[64]; make_GLSL_srcarg_string_vec3(ctx, 3, row2, sizeof (row2));
-    char code[128];
+    char code[256];
     make_GLSL_destarg_assign(ctx, code, sizeof (code),
                                 "vec3(dot(%s, %s), dot(%s, %s), dot(%s, %s))",
                                 src0, row0, src0, row1, src0, row2);
@@ -2886,7 +2886,7 @@
     char row0[64]; make_GLSL_srcarg_string_vec3(ctx, 1, row0, sizeof (row0));
     char row1[64]; make_GLSL_srcarg_string_vec3(ctx, 2, row1, sizeof (row1));
 
-    char code[128];
+    char code[256];
     make_GLSL_destarg_assign(ctx, code, sizeof (code),
                                 "vec2(dot(%s, %s), dot(%s, %s))",
                                 src0, row0, src0, row1);
--- a/mojoshader_common.c	Fri Apr 13 02:13:47 2012 -0400
+++ b/mojoshader_common.c	Fri Apr 13 16:10:48 2012 -0400
@@ -760,7 +760,7 @@
 
 int buffer_append_va(Buffer *buffer, const char *fmt, va_list va)
 {
-    char scratch[128];
+    char scratch[256];
 
     va_list ap;
     va_copy(ap, va);