Skip to content

Fix size multiplication overflow#13

Open
ferivoz wants to merge 1 commit into
tsoding:masterfrom
ferivoz:int_overflow
Open

Fix size multiplication overflow#13
ferivoz wants to merge 1 commit into
tsoding:masterfrom
ferivoz:int_overflow

Conversation

@ferivoz
Copy link
Copy Markdown
Contributor

@ferivoz ferivoz commented Sep 29, 2025

If calculation of size based on its suffix overflows, then treat it as integer overflow. Otherwise, a wrong value is returned.

Keep suffixes for backwards compatibility, i.e. report an integer overflow, not an invalid suffix.

You can see the overflow in effect with compiled example, e.g. ./example -size 1Y which cannot fit in an unsigned long long, i.e. within 64 bit.

If calculation of size based on its suffix overflows, then treat it
as integer overflow. Otherwise, a wrong value is returned.

Keep suffixes for backwards compatibility, i.e. report an integer
overflow, not an invalid suffix.
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.

1 participant