-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
add fuzzer target #366
base: master
Are you sure you want to change the base?
add fuzzer target #366
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #366 +/- ##
==========================================
- Coverage 73.19% 73.07% -0.12%
==========================================
Files 21 21
Lines 2917 2908 -9
Branches 2917 2908 -9
==========================================
- Hits 2135 2125 -10
Misses 515 515
- Partials 267 268 +1 ☔ View full report in Codecov by Sentry. |
Even on my somewhat modern computer I get only 630 exec/s. |
What do you mean by this? Do these exist in |
I tried to find the time sink in the execution with flamegraph, but most of the time it was spent executing "unknowns". Once I have more time available, I'll investigate where is the slow code
Sorry, I meant the deku assertions, like in https://github.com/wcampbell0x2a/backhand/blob/master/backhand/src/dir.rs#L22 They usually result in panic, and not Result::Error, which limits the fuzzer capability to differentiate invalid input and errors on the lib. I assume this project wants to convert those panics into errors, because the user of the lib may want to continue the execution of the program if he finds a corrupted/invalid file. |
They shouldn't result in a panic: https://github.com/sharksforarms/deku/blob/d1827d1b4ddf34def616263f0a642de9a58b1653/deku-derive/src/macros/deku_read.rs#L550C11-L550C11 |
If you remove the 255 limit from the fuzzer, you get this panic:
This is caused by this unwrap resulted from the DekuWrite |
Oh! Yes that sneaky unwrap shouldn't exist. |
I thought about that, actually this unwrap should exist. An error should be returned when trying to add a file with path > 255, not when trying to write a valid struct. This unwrap is an "assert" and should only be reachable if a mistake was made in a previous part of the execution. |
I would be of the opinion that is changed to return an |
My point is that only unreachable (or equivalent) panics are allowed. In this case, the filename with more than 255 bytes should not be allowed to be added to the struct in the first place, so the unwrap can never be reached. |
This is the target that I used to find #359 and #363.
Maybe there is something wrong with my setup, but the fuzzer is only able to get a few hundred executions per second.
This implementation is also limited by the fact that some Paths that are bigger then 255 bytes result in panic and not error. So we are limited to fuzzing paths that are 255 bytes or shorter.
I suppose having the Deku assertions being transformed from panics into errors could improve fuzzing in the future, let me know what you think.