-
Notifications
You must be signed in to change notification settings - Fork 685
Fix parseInt when passing empty string #430
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
Conversation
|
Related issue: #428 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ruben-ayrapetyan, yeah that's why I was thinking initially, thus I have this: galpeter@f3081a0 would that be ok?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@galpeter, yes, I think this would be ok.
|
@ruben-ayrapetyan, I've updated the PR, and now it uses |
|
Looks good to me |
|
LGTM |
0ad90c5 to
96d315a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Literals has constants (defines) for these characters. Please use them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zherczeg, I don't think it is wise to replace the with the equivalent LIT_ define, as those are ecma_char_t types (unit16_t), but here we use lit_utf8_byte_t (unit_8_t). Should I really replace the constants?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zherczeg, I've got a follow up fix, which rewrites the parseInt to use the lit_iterators to support unicode characters and there the constants are fixed. So should I also include the constants in this PR?
|
Please fix the above, and LGTM after that. |
|
@zherczeg, I've replaced the character constants with the |
Before allocating buffer for the string first we check that the length of it is greater then 0. If not then the result is a NaN. JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
|
Landed: ee8d650 |
Corrected the base buffer size for the string.
JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com