From 88346aae69cc12c7f6932152697a854039517aa7 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 2 Jul 2023 13:52:55 +0200 Subject: GlueGen JavaCallback: CMethodBindingEmitter: Check lockObj for NULL before GetObjectRefType(), avoid certain (older) Hotspot issues --- src/java/com/jogamp/gluegen/CMethodBindingEmitter.java | 1 + 1 file changed, 1 insertion(+) 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+" }"); -- cgit v1.2.3