Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix for exceptions in dynamic linked int64 code (#4698)
This is a backport of emscripten-core/emscripten#21759 It fixes a crash which happens when 1) An exception is thrown inside a function returning int64 2) The function is in a dynamic library and has been called through dynamic invocation.
- Loading branch information
1 parent
45bad49
commit ed9428e
Showing
2 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
From b20eefb15b19b44c79326f754c80fbb2e2df5844 Mon Sep 17 00:00:00 2001 | ||
From: Joe Marshall <joe.marshall@nottingham.ac.uk> | ||
Date: Sat, 13 Apr 2024 21:41:11 +0100 | ||
Subject: Upstream PR: https://github.com/emscripten-core/emscripten/pull/21759 | ||
|
||
--- | ||
src/library_dylink.js | 4 ++++ | ||
1 file changed, 4 insertions(+) | ||
|
||
diff --git a/src/library_dylink.js b/src/library_dylink.js | ||
index bfd0d4fcaa83..f380f4be6055 100644 | ||
--- a/src/library_dylink.js | ||
+++ b/src/library_dylink.js | ||
@@ -92,6 +92,10 @@ var LibraryDylink = { | ||
if (e !== e+0) throw e; | ||
#endif | ||
_setThrew(1, 0); | ||
+ // In theory this if could be done on creating the function, | ||
+ // but I just added this to save wasting code space | ||
+ // and it only happens on an exception | ||
+ if (sig[0] == "j") return 0n; | ||
} | ||
} | ||
}, |