libafl: fix lockfile ctr serialization#3319
Merged
tokatoka merged 1 commit intoAFLplusplus:mainfrom Jun 26, 2025
Merged
Conversation
All locations reading from the lockfile expect an integer as a string,
but in `InMemoryOnDiskCorpus<I>::remove_testcase` the raw bytes of the
integer are written to the file in little endian byte order.
This may cause "ParseIntError { kind: InvalidDigit }" in e.g.
`InMemoryOnDiskCorpus<I>::save_testcase` during parsing of the file's
contents.
Fix this by writing the integer to the lockfile as a string in
`InMemoryOnDiskCorpus<I>::remove_testcase` as well.
Member
|
the original code is 💩 but thank you this would be a quick fix meanwhile 👍 |
ThomasTNO
pushed a commit
to ThomasTNO/LibAFL
that referenced
this pull request
Aug 22, 2025
All locations reading from the lockfile expect an integer as a string,
but in `InMemoryOnDiskCorpus<I>::remove_testcase` the raw bytes of the
integer are written to the file in little endian byte order.
This may cause "ParseIntError { kind: InvalidDigit }" in e.g.
`InMemoryOnDiskCorpus<I>::save_testcase` during parsing of the file's
contents.
Fix this by writing the integer to the lockfile as a string in
`InMemoryOnDiskCorpus<I>::remove_testcase` as well.
tokatoka
pushed a commit
that referenced
this pull request
Aug 25, 2025
* Fix removing file with ctr of the form "\u{3}000"
* Ensure input is loaded, also ensure exec_time is set
* Clippy
* Revert "Fix removing file with ctr of the form "\u{3}000""
This reverts commit 4cb3507.
* libafl: fix lockfile ctr serialization (#3319)
All locations reading from the lockfile expect an integer as a string,
but in `InMemoryOnDiskCorpus<I>::remove_testcase` the raw bytes of the
integer are written to the file in little endian byte order.
This may cause "ParseIntError { kind: InvalidDigit }" in e.g.
`InMemoryOnDiskCorpus<I>::save_testcase` during parsing of the file's
contents.
Fix this by writing the integer to the lockfile as a string in
`InMemoryOnDiskCorpus<I>::remove_testcase` as well.
* Extract run target with timing
* Expose run_target_with_timing
* Simplify
* HasExecutions
* clippy
* linters
* fmt
---------
Co-authored-by: Niklas Gögge <n.goeggi@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I'm not entirely sure what the purpose of the lockfiles is but I ran into the following crash with my fuzzer:
After looking at how data is written to and read from the lockfile, it appears to expect an integer as a string when reading but in
InMemoryOnDiskCorpus<I>::remove_testcaseit writes the raw bytes of the integer to the file. See the commit message for further explanation.