summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2010-03-29 18:13:31 -0600
committerBrian Paul <[email protected]>2010-03-29 18:13:31 -0600
commit8c6f71e01e40075156c8b83f2c5e15ab73e66036 (patch)
treeba8ac1b61911afb3083d6345716a8ce97fa67bbc /src
parent5fa09846618ed702493f054a1d4b0ec2a28fbbd0 (diff)
gallivm: use constant size array, added assertion check
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_printf.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_printf.c b/src/gallium/auxiliary/gallivm/lp_bld_printf.c
index ae4d400af39..78c9ec778b6 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_printf.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_printf.c
@@ -27,6 +27,8 @@
#include <stdio.h>
+#include "util/u_debug.h"
+#include "util/u_memory.h"
#include "lp_bld_printf.h"
@@ -84,12 +86,14 @@ lp_build_printf(LLVMBuilderRef builder, const char *fmt, ...)
int i = 0;
int argcount = lp_get_printf_arg_count(fmt);
LLVMModuleRef module = LLVMGetGlobalParent(LLVMGetBasicBlockParent(LLVMGetInsertBlock(builder)));
- LLVMValueRef params[argcount + 1];
+ LLVMValueRef params[50];
LLVMValueRef fmtarg = lp_build_const_string_variable(module, fmt, strlen(fmt) + 1);
LLVMValueRef int0 = LLVMConstInt(LLVMInt32Type(), 0, 0);
LLVMValueRef index[2];
LLVMValueRef func_printf = LLVMGetNamedFunction(module, "printf");
+ assert(Elements(params) >= argcount + 1);
+
index[0] = index[1] = int0;
if (!func_printf) {