Skip to content

Commit 452e3ee

Browse files
authored
Fix undefined behavior in construction of wasm::NameType (#7736)
`wasm::Name::Name(nullptr)` ended up calling `std::string_view(nullptr)`, which is undefined and triggers an assertion in some standard libraries. https://en.cppreference.com/w/cpp/string/basic_string_view/basic_string_view.html
1 parent d97dae9 commit 452e3ee

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/wasm-builder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace wasm {
2929
struct NameType {
3030
Name name;
3131
Type type;
32-
NameType() : name(nullptr), type(Type::none) {}
32+
NameType() : type(Type::none) {}
3333
NameType(Name name, Type type) : name(name), type(type) {}
3434
};
3535

0 commit comments

Comments
 (0)