-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AFL-fuzz hang/crash fixes #1886
Conversation
E.g. nix-instantiate --eval -E 'abort "\r"' hangs. Found by afl-fuzz.
Otherwise, running e.g. nix-instantiate --eval -E --strict 'builtins.replaceStrings [""] ["X"] "abc"' would just hang in an infinite loop. Found by afl-fuzz.
The assertion is broken because there is no one-to-one mapping from length of a base64 string to the length of the output. E.g. "1q69lz7Empb06nzfkj651413n9icx0njmyr3xzq1j9q=" results in a 32-byte output. "1q69lz7Empb06nzfkj651413n9icx0njmyr3xzq1j9qy" results in a 33-byte output. To reproduce, evaluate: builtins.derivationStrict { name = "0"; builder = "0"; system = "0"; outputHashAlgo = "sha256"; outputHash = "1q69lz7Empb06nzfkj651413n9icx0njmyr3xzq1j9qy"; } Found by afl-fuzz.
Nice! Have any information on your AFL setup for Nix? Might also be fun to try on macOS due to the different codepaths we exercise. |
This is great! Next stop.... OSS-Fuzz? |
@@ -1216,7 +1216,7 @@ std::string filterANSIEscapes(const std::string & s, unsigned int width) | |||
|
|||
else if (*i == '\r') | |||
// do nothing for now | |||
; | |||
i++; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, would love a C++ unit testing framework to put this in.
The fix for an infinite loop in replaceString caused an infinite loop: e2d71bd. |
Eep. Will take a look. |
@copumpkin The setup is at https://github.com/dezgeg/fuzz-nix. However I don't actually try to build the (potential) generated derivations, just evaluate them with |
Fix three issues AFL found in ~30 hours.