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.
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.
Created attachment 654745 [details] [diff] [review] Snapshots, use the same upper-bound variables.