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

sprintf may throw a exception with wrong message when argument is a too long shared string. #3044

Closed
wants to merge 1 commit into from

Conversation

tsahara
Copy link
Member

@tsahara tsahara commented Dec 10, 2015

% bin/mruby -e 'a="1"*100; t=a[0,30]; sprintf("%u", t)'
trace:
    [0] -e:1
-e:1: string (1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111) too big for integer (ArgumentError)

The number of "1" characters should be only 30, not 100. Another case is:

% bin/mruby -e 'a="a"*100; t=a[0,30]; sprintf("%u", t)'
trace:
    [0] -e:1
-e:1: invalid string for number("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") (ArgumentError)

@matz matz closed this in ad333cd Dec 12, 2015
@tsahara
Copy link
Member Author

@tsahara tsahara commented Dec 14, 2015

The 2nd part of the patch was not applied and the 2nd case of this issue is not resolved. Why was it removed?

@tsahara tsahara deleted the pr-mrb_str_len_to_inum-exc-msg branch Jun 20, 2018
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.

None yet

1 participant