Unpack rejects array/map n > 1e6. pack() does not.
PackArray snapshots Array::Length() and walks that many elements with no policy cap. pack(arr, { interpret }) re-reads Length() for the header and the loop, so a getter that grows length extends the walk. Depth is still 512; size is not.
Apply kMaxContainer (and freeze n for the interpret loop) before packing arrays/maps. Reject sparse huge Length() the same way ScanOne rejects huge headers.
Unpack rejects array/map
n> 1e6.pack()does not.PackArraysnapshotsArray::Length()and walks that many elements with no policy cap.pack(arr, { interpret })re-readsLength()for the header and the loop, so a getter that growslengthextends the walk. Depth is still 512; size is not.Apply
kMaxContainer(and freezenfor the interpret loop) before packing arrays/maps. Reject sparse hugeLength()the same way ScanOne rejects huge headers.