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

erts: fix binary_to_integer boundary case #803

Merged
merged 1 commit into from
Sep 23, 2015

Conversation

mikpe
Copy link
Contributor

@mikpe mikpe commented Jul 31, 2015

erlang:binary_to_integer/1 and /2 fail to detect invalid
input consisting of a single + or - sign but nothing else.
For an input like <<"+">> they return 0, while list_to_integer/1
correctly signals a badarg for "+".

Fixed by checking if the input is empty after the initial +/-
sign processing.

Added a test case which fails without this fix but passes with it.

Thanks to "niku" for reporting the issue.

erlang:binary_to_integer/1 and /2 fail to detect invalid
input consisting of a single + or - sign but nothing else.
For an input like <<"+">> they return 0, while list_to_integer/1
correctly signals a badarg for "+".

Fixed by checking if the input is empty after the initial +/-
sign processing.

Added a test case which fails without this fix but passes with it.

Thanks to "niku" for reporting the issue.
@OTP-Maintainer
Copy link

Patch has passed first testings and has been assigned to be reviewed


I am a script, I am not human


@proxyles proxyles merged commit 2e61f98 into erlang:maint Sep 23, 2015
@mikpe mikpe deleted the erts-binary_to_integer-fix branch March 15, 2020 12:17
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