Open Bug 1990313 Opened 1 year ago Updated 1 year ago

storage.sync.set with object nested deeper than 128 layers throws (via webext-storage dependency on Rust's serde_json)

Categories

(WebExtensions :: Storage, defect, P3)

defect

Tracking

(Not tracked)

People

(Reporter: bdk, Unassigned)

References

Details

https://bugzilla.mozilla.org/show_bug.cgi?id=1989840 describes issues where Firefox crashes after failing to parse JSON. For that bug I'm going to fix the crash, but there will still be parsing issues. I'm not sure exactly what the behavior will be, but I'm guessing it will cause issues for where extensions will fail to persist their data and/or fail to sync. The first step for this bug is to identify steps-to-reproduce so that we can understand the issue better.

See Also: → 1990529

Test case is at https://bugzilla.mozilla.org/show_bug.cgi?id=1989840#c17

STR:

Expected:

Actual:

Edited title for clarity based on the only known case where valid JSON is rejected.

Is it feasible to use the disable_recursion_limit feature? If not, a work-around could be to serialize outside Rust, but then we'd double-serialize, which may be unfortunate. On the other hand, doing so could also fix part of bug 1960449 (see ACTION REQUIRED for storage API at https://bugzilla.mozilla.org/show_bug.cgi?id=1960449#c8).

Severity: -- → S3
Priority: -- → P3
See Also: → 1960449
Summary: JSON parsing issues cause errors on extensions → storage.sync.set with object nested deeper than 128 layers throws (via webext-storage dependency on Rust's serde_json)

I made https://bugzilla.mozilla.org/show_bug.cgi?id=1991095 with some ideas on how to fix this. I'd like to avoid disable_recursion_limit since it opens the door to some other nasty crashes (like stack overflows). I think we need to investigate more to know the solution, but my guess is that the avoid the depth at the browser level option would be the best. I think it might require an extra level of serialization, but I'm hoping any performance hit will be negligible.

You need to log in before you can comment on or make changes to this bug.