fuzz: allows compiler=stackoverflow,intp=unreachable (#1779)
Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
This commit is contained in:
@@ -60,7 +60,11 @@ const (
|
||||
func CheckStackGuardPage(s []byte) {
|
||||
for i := 0; i < StackGuardCheckGuardPageSize; i++ {
|
||||
if s[i] != 0 {
|
||||
panic(fmt.Sprintf("BUG: stack guard page is corrupted: %s", hex.EncodeToString(s[:StackGuardCheckGuardPageSize])))
|
||||
panic(
|
||||
fmt.Sprintf("BUG: stack guard page is corrupted:\n\tguard_page=%s\n\tstack=%s",
|
||||
hex.EncodeToString(s[:StackGuardCheckGuardPageSize]),
|
||||
hex.EncodeToString(s[StackGuardCheckGuardPageSize:]),
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
//! This module provides the functions implemented by wazero via CGo.
|
||||
|
||||
use wasm_smith::SwarmConfig;
|
||||
|
||||
extern "C" {
|
||||
// require_no_diff is implemented in Go, and accepts the pointer to the binary and its size.
|
||||
#[allow(dead_code)]
|
||||
|
||||
@@ -314,6 +314,12 @@ func ensureInvocationError(compilerErr, interpErr error) error {
|
||||
interpErrMsg = interpErrMsg[:strings.Index(interpErrMsg, "\n")]
|
||||
}
|
||||
|
||||
if strings.Contains(compilerErrMsg, "stack overflow") && 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
|
||||
}
|
||||
|
||||
if compilerErrMsg != interpErrMsg {
|
||||
return fmt.Errorf("error mismatch:\n\tinterpreter: %v\n\tcompiler: %v", interpErr, compilerErr)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user