Commit d50043f
authored
[EH] Make lsan/asan work with Wasm EH (#23552)
`std::rethrow_exception` leaked memory because dependent exceptions were
not recognized as such and thus not freed properly here:
https://github.com/emscripten-core/emscripten/blob/44fd294e8244afa710cecb2c10c9a644a6549b8e/system/lib/libcxxabi/src/cxa_exception.cpp#L575-L583
The reason for that was, in `__cxa_rethrow_primary_exception`, we were
incorrectly throwing the primary exception, not the dependent one. I
think the error was introduced during copy-pasting.
`isDependentException` method was copied from `cxa_exception.cpp`,
because it is a static function, as in the case for other utility
functions in that file.
This also adds handling for dependent exceptions in
`__get_exception_message`.
Fixes #21124.1 parent 44fd294 commit d50043f
File tree
4 files changed
+17
-14
lines changed- system/lib/libcxxabi/src
- test
4 files changed
+17
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
789 | 789 | | |
790 | 790 | | |
791 | 791 | | |
792 | | - | |
| 792 | + | |
793 | 793 | | |
794 | | - | |
| 794 | + | |
795 | 795 | | |
796 | 796 | | |
797 | 797 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
41 | 49 | | |
42 | 50 | | |
43 | 51 | | |
| |||
78 | 86 | | |
79 | 87 | | |
80 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
81 | 96 | | |
82 | 97 | | |
83 | 98 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
641 | 641 | | |
642 | 642 | | |
643 | 643 | | |
644 | | - | |
645 | | - | |
646 | | - | |
647 | 644 | | |
648 | 645 | | |
649 | 646 | | |
| |||
677 | 674 | | |
678 | 675 | | |
679 | 676 | | |
680 | | - | |
681 | | - | |
682 | | - | |
683 | 677 | | |
684 | 678 | | |
685 | 679 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1328 | 1328 | | |
1329 | 1329 | | |
1330 | 1330 | | |
1331 | | - | |
1332 | | - | |
1333 | 1331 | | |
1334 | 1332 | | |
1335 | 1333 | | |
| |||
1346 | 1344 | | |
1347 | 1345 | | |
1348 | 1346 | | |
1349 | | - | |
1350 | | - | |
1351 | 1347 | | |
1352 | 1348 | | |
1353 | 1349 | | |
| |||
1499 | 1495 | | |
1500 | 1496 | | |
1501 | 1497 | | |
1502 | | - | |
1503 | | - | |
1504 | 1498 | | |
1505 | 1499 | | |
1506 | 1500 | | |
| |||
0 commit comments