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

Fix adding entries to the internal buffer of a Map object #3805

Merged
merged 1 commit into from
May 28, 2020

Conversation

dbatyai
Copy link
Member

@dbatyai dbatyai commented May 27, 2020

When appending the key/value pair separately, garbage collection could be
triggered before the value is added, which could cause problems during
marking. This patch changes insertion to add both values at the same
time, which prevents partial entries from being present in the internal
buffer.

Fixes #3804.

@dbatyai dbatyai added bug Undesired behaviour ecma builtins Related to ECMA built-in routines labels May 27, 2020
When appending the key/value pair separately, garbage collection could be
triggered before the value is added, which could cause problems during
marking. This patch changes insertion to add both values at the same
time, which prevents partial entries from being present in the internal
buffer.

Fixes jerryscript-project#3804.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai [email protected]
@dbatyai
Copy link
Member Author

dbatyai commented May 27, 2020

I'm not sure about adding a test case for this specific issue. We would need to trigger the GC at a very specific point, and even if I add a test that would fail at the moment, any changes later that affect memory usage would make the test invalid. Any suggestions?

@dbatyai dbatyai requested review from rerobika and galpeter May 27, 2020 19:48
Copy link
Member

@rerobika rerobika left a comment

Choose a reason for hiding this comment

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

LGTM

@ossy-szeged
Copy link
Contributor

LGTM (informal)

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.

LGTM

@zherczeg zherczeg merged commit c2b6621 into jerryscript-project:master May 28, 2020
@dbatyai dbatyai deleted the map_add_gc branch June 10, 2020 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Undesired behaviour ecma builtins Related to ECMA built-in routines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Memory corruption in ecma_gc_set_object_visited (jerry-core/ecma/base/ecma-gc.c:85)
4 participants