Previously the fuzz test considered any exception which contains the string Internal bug detected (magic string) as a bug. This is not true when the user (fuzzer) passes in the magic string from outside.
Fix that by:
- Changing the format the string in
NonFatalCheckErrorto start with the magic string. - Only treat exceptions that start with the magic string as internal bugs.
This should fix the bug because any other exception shouldn't start with the magic string.
To test:
echo 'bG9nZ2luZ1y+bUludGVybmFsIGJ1ZyBkZXRlY3RlZAAXCqNcjqNcjuYjeg==' | base64 --decode > /tmp/a
FUZZ=rpc ./src/test/fuzz/fuzz /tmp/a
Before:
fuzz: test/fuzz/rpc.cpp:365: void rpc_fuzz_target(FuzzBufferType): Assertion `error_msg.find("trigger_internal_bug") != std::string::npos' failed.
After:
Executed /tmp/a in 0 ms