aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-07-02 13:52:55 +0200
committerSven Gothel <[email protected]>2023-07-02 13:52:55 +0200
commit88346aae69cc12c7f6932152697a854039517aa7 (patch)
treeea71eb06232482138c8efcdc79c68068ed0ddae8
parent3ee4a042aee86657128b834dad553baf83834612 (diff)
GlueGen JavaCallback: CMethodBindingEmitter: Check lockObj for NULL before GetObjectRefType(), avoid certain (older) Hotspot issues
-rw-r--r--src/java/com/jogamp/gluegen/CMethodBindingEmitter.java1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java b/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java
index f0cc536..fc65fb4 100644
--- a/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java
+++ b/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java
@@ -382,6 +382,7 @@ public class CMethodBindingEmitter extends FunctionEmitter {
unit.emitln(" // Use-after-free of '*cb' possible up until after GetObjectRefType() check for a brief moment!");
unit.emitln(" // Use a copy to avoid data-race between GetObjectRefType() and MonitorEnter()\");");
unit.emitln(" jobject lockObj = cb->lockObj;");
+ unit.emitln(" if( 0 == lockObj ) { fprintf(stderr, \"Info: Callback '"+jcbFriendlyBasename+"': NULL lock, skipping!\\n\"); "+returnStatement+" }");
unit.emitln();
unit.emitln(" jobjectRefType refType = (*env)->GetObjectRefType(env, lockObj);");
unit.emitln(" if( 0 == refType ) { fprintf(stderr, \"Info: Callback '"+jcbFriendlyBasename+"': User after free(lock), skipping!\\n\"); "+returnStatement+" }");