After instantiation, read the exported table "t" at index 0 and verify the null reference has been normalized to an abstract heap type. This catches the root cause of #4757 without executing wasm that would segfault if the fix is absent.
| 57 | /// the root cause of #4757 without executing wasm that would segfault if the |
| 58 | /// fix is absent. |
| 59 | bool checkNullTableEntry(VM::VM &VMInst) { |
| 60 | const auto *ModInst = VMInst.getActiveModule(); |
| 61 | if (!ModInst) { |
| 62 | return false; |
| 63 | } |
| 64 | auto *TabInst = ModInst->findTableExports("t"); |
| 65 | if (!TabInst) { |
| 66 | return false; |
| 67 | } |
| 68 | auto RefRes = TabInst->getRefAddr(0); |
| 69 | if (!RefRes) { |
| 70 | return false; |
| 71 | } |
| 72 | auto Ref = *RefRes; |
| 73 | EXPECT_TRUE(Ref.isNull()); |
| 74 | EXPECT_TRUE(Ref.getType().isAbsHeapType()) |
| 75 | << "Null reference in concrete-typed table must be normalized to an " |
| 76 | "abstract heap type (issue #4757)"; |
| 77 | return Ref.isNull() && Ref.getType().isAbsHeapType(); |
| 78 | } |
| 79 | |
| 80 | // clang-format off |
| 81 | /// Binary Wasm module with functions testing ref.test on externalized refs. |
no test coverage detected