Skip to content

Fix bug in jerry_string_to_char_buffer. #1210

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
Jul 15, 2016

Conversation

jiangzidong
Copy link
Contributor

Str_len can smaller than buffer_size.

  if (ecma_string_get_size (str_p) > buffer_size)
  {
    return 0;
  }

It should be ">" in the comparison.

And also change the related code in unit-test-api.c.
Before, in the foreach, it only sunk into

  if (sz == 0)
  {
    JERRY_ASSERT (!strncmp ((const char *) user_data, "user_data", 9));
    return true;
  }

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

@zherczeg
Copy link
Member

LGTM

@LaszloLango LaszloLango added bug Undesired behaviour api Related to the public API labels Jul 15, 2016
@LaszloLango LaszloLango added this to the Release v1.0 milestone Jul 15, 2016
@LaszloLango
Copy link
Contributor

LGTM

@LaszloLango
Copy link
Contributor

@jiangzidong, please rebase to the current master, so we can land it properly.

@LaszloLango LaszloLango merged commit 6084f08 into jerryscript-project:master Jul 15, 2016
str_len can smaller than buffer_size.

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
api Related to the public API bug Undesired behaviour
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants