diff --git a/Changes.md b/Changes.md index d3372b98b..3fe91b586 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 * Added timedWait to hx::thread::ConditionVariable, which Haxe 5's sys.thread.Condition.timedWait calls: with the Haxe nightly, every program that used Condition failed to compile. It returns true once a signal or broadcast came and false when the time ran out, and it waits out the wakeups MSVC's timed waits give just before the deadline with nothing signalled * 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) 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 ); 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 000000000..af65d0a58 Binary files /dev/null and b/test/fuzz/regressions/cppia/static-call-on-a-host-interface differ