Skip to content

Conversation

@Fusl
Copy link
Contributor

@Fusl Fusl commented Aug 3, 2025

This one was found by afl++. Executing scan 0 count n with a count that is within 10% of LONG_MAX, count * 10 would cause maxiterations to overflow. This is technically not a real problem since the way maxiterations is used would eventually cause it to underflow back to LONG_MAX again and continue counting down from there but I figured we may want to fix this regardless for expected behavior correctness?

@Fusl Fusl force-pushed the fusl-scan-count-multi-overflow-fix branch from 237e191 to 736ac48 Compare August 3, 2025 12:29
Copy link
Member

@ranshid ranshid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ranshid ranshid merged commit 52b5519 into valkey-io:unstable Aug 5, 2025
50 checks passed
allenss-amazon pushed a commit to allenss-amazon/valkey-core that referenced this pull request Aug 19, 2025
…can with extremely large count (valkey-io#2414)

This one was found by
[afl++](https://github.com/AFLplusplus/AFLplusplus). Executing `scan 0
count n` with a count that is within 10% of `LONG_MAX`, `count * 10`
would cause `maxiterations` to overflow. This is technically not a real
problem since the way `maxiterations` is used would eventually cause it
to underflow back to `LONG_MAX` again and continue counting down from
there but I figured we may want to fix this regardless for expected
behavior correctness?

Signed-off-by: Fusl <[email protected]>
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.

3 participants