diff options
Diffstat (limited to 'src/net/java/games/gluegen/CMethodBindingEmitter.java')
-rw-r--r-- | src/net/java/games/gluegen/CMethodBindingEmitter.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/net/java/games/gluegen/CMethodBindingEmitter.java b/src/net/java/games/gluegen/CMethodBindingEmitter.java index 0c41d3aa2..5cf2833d9 100644 --- a/src/net/java/games/gluegen/CMethodBindingEmitter.java +++ b/src/net/java/games/gluegen/CMethodBindingEmitter.java @@ -702,9 +702,19 @@ public class CMethodBindingEmitter extends FunctionEmitter } // end of data copy if (EMIT_NULL_CHECKS) { - writer.println(" }"); - } + writer.print(" }"); + if (needsDataCopy) { + writer.println(); + } else { + // Zero out array offset in the case of a null pointer + // being passed down to prevent construction of arbitrary + // pointers + writer.println(" else {"); + writer.println(" " + binding.getArgumentName(i) + "_offset = 0;"); + writer.println(" }"); + } + } } else if (javaArgType.isString()) { if (emittingPrimitiveArrayCritical) { continue; |