Skip to content
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

Fix i2srandreplace #2504

Merged
merged 1 commit into from
Aug 30, 2024
Merged

Fix i2srandreplace #2504

merged 1 commit into from
Aug 30, 2024

Conversation

mineo333
Copy link
Contributor

There is an issue in I2SRandReplace where not all indexes are checked. We can go all the way to =len-sizeof(cmp_val_size). This is because when we extract the word from the bytes, we do i..i+sizeof(cmp_val_size) which is equivalent to len-sizeof(cmp_val_size)..len which is valid.

@tokatoka
Copy link
Member

                    let mut size = core::cmp::min(v.0.len(), len - i);
                    while size != 0 {
                        if v.0[0..size] == input.bytes()[i..i + size] {

here should be len, too?

@mineo333
Copy link
Contributor Author

I don't think so because that would result in an overflow somtimes.

If we made that len, then if v.0.len > len, then we would compare v.0[0..len] == bytes[i..i+len] which would overflow. Then len-i ensures that doesn't happen as we are, at maximum, allowed to have bytes[i..i+len-i] = bytes[i..len] on the rhs.

@tokatoka tokatoka merged commit 1113879 into AFLplusplus:main Aug 30, 2024
100 checks passed
Marcondiro pushed a commit to Marcondiro/LibAFL that referenced this pull request Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants