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 cyclic JSON.stringify / primitive conversion stack overflows #777

Merged
merged 13 commits into from
Oct 5, 2020

Commits on Oct 3, 2020

  1. Add tests for cyclic conversions

    These tests currently fail by overflowing the stack.
    Value comparisons are drawn from what Chrome
    and Firefox do, which doesn't appear to be in the
    spec?
    vgel committed Oct 3, 2020
    Configuration menu
    Copy the full SHA
    815f9b9 View commit details
    Browse the repository at this point in the history
  2. Add another test for a non-cyclic scenario

    This test is likely to be broken by the next change
    vgel committed Oct 3, 2020
    Configuration menu
    Copy the full SHA
    f30adf5 View commit details
    Browse the repository at this point in the history
  3. cargo fmt

    vgel committed Oct 3, 2020
    Configuration menu
    Copy the full SHA
    340f0f4 View commit details
    Browse the repository at this point in the history
  4. Refactor the existing RecursionLimiter type

    We can use the existing RecursionLimiter type
    used by GcObject's Debug impl for this purpose.
    We just need to refactor it to allow both liveness
    and visitation tracking, using a HashMap of ptrs
    to states instead of a HashSet of ptrs.
    vgel committed Oct 3, 2020
    Configuration menu
    Copy the full SHA
    877906f View commit details
    Browse the repository at this point in the history
  5. Fix Value::to_json to not overflow.

    Use the newly refactored RecursionLimiter to
    check for recursion, and limit it. Throw a TypeError
    as mandated by the spec.
    vgel committed Oct 3, 2020
    Configuration menu
    Copy the full SHA
    e60fb64 View commit details
    Browse the repository at this point in the history
  6. Fix ordinary_to_primitive to not overflow

    Use the new RecursionLimiter type to prevent
    overflows from conversions in ordinary_to_primitive.
    The spec doesn't say what to do here, so we follow
    v8 / SpiderMonkey in returning a default value for
    the type hint -- either 0. or "". More details in
    the method documentation.
    vgel committed Oct 3, 2020
    Configuration menu
    Copy the full SHA
    d043c9f View commit details
    Browse the repository at this point in the history
  7. Merge branch 'master' into fix-cyclic-overflows

    Someone added `as_gc_object` right as I added
    `add_gcobject`. What are the chances? Switched
    to the new method.
    vgel committed Oct 3, 2020
    Configuration menu
    Copy the full SHA
    8fa7bf9 View commit details
    Browse the repository at this point in the history
  8. Cargo fmt and make clippy happy

    vgel committed Oct 3, 2020
    Configuration menu
    Copy the full SHA
    bd6e099 View commit details
    Browse the repository at this point in the history

Commits on Oct 5, 2020

  1. Configuration menu
    Copy the full SHA
    2df908a View commit details
    Browse the repository at this point in the history
  2. Move object_to_json to GcObject

    vgel committed Oct 5, 2020
    Configuration menu
    Copy the full SHA
    6e251e6 View commit details
    Browse the repository at this point in the history
  3. Add test for console.log

    vgel committed Oct 5, 2020
    Configuration menu
    Copy the full SHA
    3300fe2 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    30aadab View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    2cc55b9 View commit details
    Browse the repository at this point in the history