From ce8750b7a6b129849a38141f730a25bcbc3712e8 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 7 Jan 2022 11:15:41 -0800 Subject: Warn about and ignore empty local/param names in name section (#4426) Fixes the crash in #4418 Also replace the .at() there with better logic to handle imported functions. See WebAssembly/wabt#1799 for details on why wabt sometimes emits this. --- test/lit/binary/empty-param-name.test | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 test/lit/binary/empty-param-name.test (limited to 'test/lit/binary/empty-param-name.test') diff --git a/test/lit/binary/empty-param-name.test b/test/lit/binary/empty-param-name.test new file mode 100644 index 000000000..2216d0bbb --- /dev/null +++ b/test/lit/binary/empty-param-name.test @@ -0,0 +1,14 @@ +;; Test that we show a warning on an empty local name, and do not crash. +;; +;; The binary contains this, processed by wabt with debug names: +;; +;; (module +;; (func $foo (import "imports" "foo") (param i32))) +;; +;; Wabt emits a name for that parameter, but it is the empty string. See +;; https://github.com/WebAssembly/wabt/issues/1799 + +;; RUN: wasm-opt %s.wasm 2>&1 | filecheck %s + +;; CHECK: warning: empty local name at index 0 in function foo + -- cgit v1.2.3