Skip to content

Commit 22fc4f7

Browse files
committed
test: Imported memory/tables limits having max less than min
1 parent 7e7d3bf commit 22fc4f7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/unittests/instantiate_test.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,10 @@ TEST(instantiate, imported_table_invalid)
177177
EXPECT_THROW_MESSAGE(instantiate(*module, {}, {{&table, {10, std::nullopt}}}),
178178
instantiate_error, "provided import's max is above import's max defined in module");
179179

180+
// Provided limits have max less than min
181+
EXPECT_THROW_MESSAGE(instantiate(*module, {}, {{&table, {10, 0}}}), instantiate_error,
182+
"provided imported table doesn't fit provided limits");
183+
180184
// Null pointer
181185
EXPECT_THROW_MESSAGE(instantiate(*module, {}, {{nullptr, {10, 30}}}), instantiate_error,
182186
"provided imported table has a null pointer to data");
@@ -283,6 +287,10 @@ TEST(instantiate, imported_memory_invalid)
283287
EXPECT_THROW_MESSAGE(instantiate(*module, {}, {}, {{&memory, {1, std::nullopt}}}),
284288
instantiate_error, "provided import's max is above import's max defined in module");
285289

290+
// Provided limits have max less than min
291+
EXPECT_THROW_MESSAGE(instantiate(*module, {}, {}, {{&memory, {1, 0}}}), instantiate_error,
292+
"provided imported memory doesn't fit provided limits");
293+
286294
// Null pointer
287295
EXPECT_THROW_MESSAGE(instantiate(*module, {}, {}, {{nullptr, {1, 3}}}), instantiate_error,
288296
"provided imported memory has a null pointer to data");

0 commit comments

Comments
 (0)