Skip to content

Fix a bug in ArrayBuffer #1479

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

Merged
merged 1 commit into from
Dec 9, 2016
Merged

Conversation

jiangzidong
Copy link
Contributor

  • free_value after ecma_op_to_number
  • add a related test file

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang [email protected]

@@ -50,8 +50,11 @@ ecma_op_create_arraybuffer_object (const ecma_value_t *arguments_list_p, /**< li

if (arguments_list_len > 0)
{
ecma_number_t num = ecma_get_number_from_value (ecma_op_to_number (arguments_list_p[0]));
ecma_value_t num_value = ecma_op_to_number (arguments_list_p[0]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can also be a conversion exception.


try
{
var a = new ArrayBuffer(5.5);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be another case with:

var a = new ArrayBuffer("a string");

Or something non-number.

Copy link
Member

@zherczeg zherczeg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After the minor style fix, LGTM.

@@ -50,12 +50,21 @@ ecma_op_create_arraybuffer_object (const ecma_value_t *arguments_list_p, /**< li

if (arguments_list_len > 0)
{
ecma_number_t num = ecma_get_number_from_value (ecma_op_to_number (arguments_list_p[0]));
ecma_value_t ret = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY);
ECMA_OP_TO_NUMBER_TRY_CATCH (num, arguments_list_p[0], ret);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please put a newline before ECMA_OP_TO_NUMBER_TRY_CATCH.

Copy link
Contributor

@LaszloLango LaszloLango left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zherczeg
Copy link
Member

zherczeg commented Dec 9, 2016

Excellent patch!

@zherczeg zherczeg merged commit 551aaa5 into jerryscript-project:master Dec 9, 2016
@zherczeg
Copy link
Member

zherczeg commented Dec 9, 2016

I hope you don't mind that I changed the patch description a bit. But please be a bit more verbose in the future.

* free_value after ecma_op_to_number
* add related test file

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang [email protected]
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