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

Array handling improvements, fix GH-2023 #2146

Merged
merged 3 commits into from
Jul 16, 2019
Merged

Array handling improvements, fix GH-2023 #2146

merged 3 commits into from
Jul 16, 2019

Conversation

svaarala
Copy link
Owner

* Add bug testcase for GH-2023.

* Testcase coverage improvement for Object.defineProperty() and array
  part handling.
When array size is limited to 16 bits, some internal operations which
don't support abandoning the array could try to grow it beyond 16 bits
rather than abandoning the array part.  This caused an assertion failure
and also potentially memory unsafe behavior.

Changes:

* When growing the property table, sanity check entry and array sizes.
  If the new values won't fit in the duk_hobject structure (which may
  happen with 16-bit fields), fail the grow attempt with an internal
  error.  This avoids field truncation and potentially memory unsafe
  behavior as a result.

* Rework array part growth vs. abandon code to avoid the GH-2023 issue.

* Add support for keeping array part when possible into
  Object.defineProperty().

* Add support for abandoning array part when using internal variants
  for defining properties (such as in Array .map()).

* Executor compile warning fix.

* Debug logging trivia, downgrade a noisy log entry.

* Fix compile warning in duk_cmdline.c.
@svaarala svaarala added the bug label Jul 15, 2019
@svaarala svaarala added this to the v2.4.0 milestone Jul 15, 2019
@svaarala svaarala merged commit 1de2be9 into master Jul 16, 2019
@svaarala svaarala deleted the fix-gh2023 branch July 16, 2019 00:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

assertion failed: (duk_size_t) a_size <= DUK_HOBJECT_MAX_PROPERTIES in duk__get_min_grow_a
1 participant