IonMonkey: Check & Fix usage of writeSlotHeader in Snapshots.cpp

RESOLVED FIXED

Status

()

Core
JavaScript Engine
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: nbp, Assigned: nbp)

Tracking

Other Branch
x86_64
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [ion:p1:fx18])

Attachments

(1 attachment)

writeSlotHeader assert that each of its argument are under the maximal payload for each value.  Some usage of it are apparently not tested because the assertion does not hold with Register::Invalid.
No longer blocks: 745386
Whiteboard: [ion:t
Whiteboard: [ion:t → [ion:t]
This bug can be triggered by using many allocations such as we don't have enough registers to hold all the values.  When we don't have enough registers, we will fallback to

addSlot(JSValueType type, int32 stackIndex)
addSlot(int32 valueStackSlot)

which are using writeSlotHeader with Register::Invalid and FloatRegister::Invalid (UINT_MAX) instead of MAX_REG_FIELD_VALUE (31).  This should fail an assertion in debug builds and may cause the snapshot reader to read bad values in optimized builds.
Whiteboard: [ion:t] → [ion:p1:fx18]
Assignee: general → nicolas.b.pierron
Status: NEW → ASSIGNED
Created attachment 654745 [details] [diff] [review]
Snapshots, use the same upper-bound variables.
Attachment #654745 - Flags: review?(dvander)
Attachment #654745 - Flags: review?(dvander) → review+
https://hg.mozilla.org/projects/ionmonkey/rev/85635d695d12
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.