From 0ccdaf1bbd0592fcdf6d0bb12a3415422f4c4a12 Mon Sep 17 00:00:00 2001 From: Chris Speciale Date: Fri, 13 Nov 2026 01:08:35 -0500 Subject: [PATCH 1/2] Link a static call on a host interface without its missing glue The fuzz job's cppia target stopped in CallStatic::link with "member call on null pointer of type 'hx::HaxeNativeClass'", on #442's run. A static call whose type had a host class looked the function up in that class's script glue, haxeBase, which a host interface does not have. Haxe gives an interface no statics, so only a malformed file makes such a call. It goes on to the field lookup the other host classes fall back to, and the file fails to load as for any other static that is not there. --- Changes.md | 1 + src/hx/cppia/Cppia.cpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Changes.md b/Changes.md index d76013cc0..4251e3f9f 100644 --- a/Changes.md +++ b/Changes.md @@ -2,6 +2,7 @@ libhxcpp 6.0.0 (unreleased) ------------------------------------------------------------ +* Fixed a malformed cppia file that calls a static function on a host interface crashing the loader: it looked the function up in the interface's script glue, which an interface does not have. The fuzz job found it * Fixed an exception from blit, setSize or resize under the cppia JIT ending the process instead of reaching the script's catch, on typed arrays and on Array: their native calls had no exception bridge. The script catches it, as it does interpreted and in compiled code (libhxcpp #404) * Fixed resize() and cpp.NativeArray.setSize() on an Array under the cppia JIT evaluating the array expression twice, so a call in it ran twice and the array it returned the second time was the one resized. The JIT evaluates it once (libhxcpp #411) * Fixed indexOf and lastIndexOf on an Array under the cppia JIT ignoring fromIndex: the JIT never generated it, so a call or exception in it was lost too. The search starts from it, as it does interpreted and in compiled code (libhxcpp #410) diff --git a/src/hx/cppia/Cppia.cpp b/src/hx/cppia/Cppia.cpp index e5262dcaa..af0be4a78 100644 --- a/src/hx/cppia/Cppia.cpp +++ b/src/hx/cppia/Cppia.cpp @@ -2141,7 +2141,9 @@ struct CallStatic : public CppiaExpr if (!replace && type->haxeClass.mPtr) { - ScriptNamedFunction func = type->haxeBase->findStaticFunction(field); + // A host interface has a class but no script glue, and only a + // malformed file calls a static on one + ScriptNamedFunction func = type->haxeBase ? type->haxeBase->findStaticFunction(field) : ScriptNamedFunction(); if (func.signature) { //CPPIALOG(" found function %s\n", func.signature ); From 9c3fda3f7edf68d559e6e4f275ff7d6d8ded8fdf Mon Sep 17 00:00:00 2001 From: Chris Speciale Date: Fri, 13 Nov 2026 01:55:23 -0500 Subject: [PATCH 2/2] Add the fuzz input with a static call on a host interface The input from #442's fuzz run. Replayed with run.sh --replay cppia, main's loader segfaults on it and this branch's loads all ten cppia inputs. --- .../cppia/static-call-on-a-host-interface | Bin 0 -> 780 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 test/fuzz/regressions/cppia/static-call-on-a-host-interface diff --git a/test/fuzz/regressions/cppia/static-call-on-a-host-interface b/test/fuzz/regressions/cppia/static-call-on-a-host-interface new file mode 100644 index 0000000000000000000000000000000000000000..af65d0a582ce4c7e697e843bbc7c76e9a737dae5 GIT binary patch literal 780 zcmZ8d-EP`27_|){!vQMjFr8G8*Y;{!q0qlYNRzt3MYVRTvkKHuD2e&U@oekA#^4AoD5B13Pg_^BLer4oKFhtWJt zl;&r0tR|C4^0t&htSbNj literal 0 HcmV?d00001