Skip to content
This repository was archived by the owner on May 11, 2020. It is now read-only.

Commit 0864b86

Browse files
laizysbinet
authored andcommitted
wasm: fix infinite recursion in DuplicateExportError
1 parent 55a1639 commit 0864b86

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

wasm/module_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,3 +168,8 @@ func TestModuleSignatureCheck(t *testing.T) {
168168
})
169169
}
170170
}
171+
172+
func TestDuplicateExportError_NoStackOverflow(t *testing.T) {
173+
err := wasm.DuplicateExportError("h")
174+
_ = err.Error()
175+
}

wasm/section.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ func (s *SectionExports) WritePayload(w io.Writer) error {
633633
type DuplicateExportError string
634634

635635
func (e DuplicateExportError) Error() string {
636-
return fmt.Sprintf("Duplicate export entry: %s", e)
636+
return fmt.Sprintf("Duplicate export entry: %s", string(e))
637637
}
638638

639639
// ExportEntry represents an exported entry by the module

0 commit comments

Comments
 (0)