Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Crash when calling JSON.stringify on an AbstractValue #2411

Closed
sb98052 opened this issue Aug 9, 2018 · 0 comments
Closed

Crash when calling JSON.stringify on an AbstractValue #2411

sb98052 opened this issue Aug 9, 2018 · 0 comments
Assignees

Comments

@sb98052
Copy link

sb98052 commented Aug 9, 2018

(function () {
  let o = __abstract("object", "(o)");
  let s;
  s = "A" + JSON.stringify(o);

  global.s = s;
})();

leads to:

Invariant Violation:                                                                                   
This is likely a bug in Prepack, not your code. Feel free to open an issue on GitHub.          
    at invariant (/Users/gwsapan/Projects/prepack/lib/invariant.js:24:15)                               
    at ValuesDomain.getElements (/Users/gwsapan/Projects/prepack/lib/domains/ValuesDomain.js:71:28)          
    at AbstractObjectValue.getTemplate (/Users/gwsapan/Projects/prepack/lib/values/AbstractObjectValue.js:42:37)
    at InternalJSONClone (/Users/gwsapan/Projects/prepack/lib/intrinsics/ecma262/JSON.js:302:87)
    at NativeFunctionValue.obj.defineNativeMethod [as callback] (/Users/gwsapan/Projects/prepack/lib/intrinsics/ecma262
/JSON.js:471:25)
    at NativeFunctionValue.callCallback (/Users/gwsapan/Projects/prepack/lib/values/NativeFunctionValue.js:85:51)
    at functionCall (/Users/gwsapan/Projects/prepack/lib/methods/call.js:248:26)
    at callNativeFunctionValue (/Users/gwsapan/Projects/prepack/lib/methods/call.js:274:10)
    at OrdinaryCallEvaluateBody (/Users/gwsapan/Projects/prepack/lib/methods/call.js:280:12)
    at InternalCall (/Users/gwsapan/Projects/prepack/lib/methods/function.js:80:49)
    at FunctionImplementation.$Call (/Users/gwsapan/Projects/prepack/lib/methods/function.js:748:12)
    at NativeFunctionValue.$Call (/Users/gwsapan/Projects/prepack/lib/values/NativeFunctionValue.js:25:36)
    at Call (/Users/gwsapan/Projects/prepack/lib/methods/call.js:494:12)
@sb98052 sb98052 self-assigned this Aug 9, 2018
facebook-github-bot pushed a commit that referenced this issue Aug 15, 2018
Summary:
Fixes #2151 #2222 #2279 #2393 #2399 #2404 #2411 #2414 #2415
Added a fuzz testing tool
Added test cases
Turn crash in JSON.stringify into a diagnostic
Adds a `arrayNestedOptimizedFunctionsEnabled` flag to enable nested optimized functions derived from Array.prototype methods (like `map`) and Array.from
Refactor assignment on partial or possibly deleted property
Rewrote the joining logic to always do a full join at every join point
Removed last remnants of delayUnsupportedRequires

Reviewed By: cblappert

Differential Revision: D9349841

fbshipit-source-id: 74a16dbb015777d59d23fdfde77abbe2489c292a
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant