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 bugs in bound handling #97

Merged
merged 4 commits into from
Jun 30, 2024
Merged

Conversation

dag-erling
Copy link
Collaborator

@dag-erling dag-erling commented Apr 26, 2024

This fixes #55.

@dag-erling dag-erling force-pushed the des/bad-bounds branch 2 times, most recently from 8dbc127 to 8b673d3 Compare April 26, 2024 11:33
According to POSIX, the correct error to return when a bound count
exceeds `RE_DUP_MAX` is `REG_BADBR`, not `REG_BADPAT`.
If no maximum count was given, `max == -1`, so `min` can be legitimately
greater than `max`, and it is not sufficient to only check that `max`
does not exceed `RE_DUP_MAX`.
Signed integer overflow is undefined behavior, so use unsigned long
internally while parsing numbers, and substitute INT_MAX at the end if
overflow occurred.
@dag-erling dag-erling merged commit ca34130 into laurikari:master Jun 30, 2024
2 checks passed
@dag-erling dag-erling deleted the des/bad-bounds branch July 30, 2024 16:57
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.

Integer overflow and missing checks when parsing bounds
1 participant