Skip to content

Commit

Permalink
fuzz: ignores the stack detail during stack overflow (tetratelabs#1849)
Browse files Browse the repository at this point in the history
Signed-off-by: Takeshi Yoneda <[email protected]>
  • Loading branch information
mathetake authored Nov 27, 2023
1 parent 1afa54f commit 9ec7256
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/integration_test/fuzz/wazerolib/nodiff.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,13 @@ func ensureInvocationError(compilerErr, interpErr error) error {
interpErrMsg = interpErrMsg[:strings.Index(interpErrMsg, "\n")]
}

if strings.Contains(compilerErrMsg, "stack overflow") && strings.Contains(interpErrMsg, "unreachable") {
if compiledStackOverFlow := strings.Contains(compilerErrMsg, "stack overflow"); compiledStackOverFlow && strings.Contains(interpErrMsg, "unreachable") {
// Compiler is more likely to reach stack overflow than interpreter, so we allow this case. This case is most likely
// that interpreter reached the unreachable out of "fuel".
return nil
} else if interpreterStackOverFlow := strings.Contains(interpErrMsg, "stack overflow"); compiledStackOverFlow && interpreterStackOverFlow {
// Both compiler and interpreter reached stack overflow, so we ignore diff in the content of the traces.
return nil
}

if compilerErrMsg != interpErrMsg {
Expand Down

0 comments on commit 9ec7256

Please sign in to comment.