Commit 1cc4331e authored by Marja Hölttä's avatar Marja Hölttä Committed by V8 LUCI CQ

[rab/gsab] Zero out length tracking TA byte_length

Only hardening; no behavioral changes.

Bug: v8:11111
Change-Id: I66765b661485334b1b14d9ceaa16a8df355d1898
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3826246Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82429}
parent ab6bf0ce
......@@ -57,7 +57,14 @@ transitioning macro AllocateTypedArray(implicit context: Context)(
typedArray.elements = elements;
typedArray.buffer = buffer;
typedArray.byte_offset = byteOffset;
typedArray.byte_length = byteLength;
if (isLengthTracking) {
dcheck(IsResizableArrayBuffer(buffer));
// Make the byte_length of length-tracking TAs zero, so that we won't
// accidentally use it and access invalid data.
typedArray.byte_length = 0;
} else {
typedArray.byte_length = byteLength;
}
typedArray.length = length;
typedArray.bit_field.is_length_tracking = isLengthTracking;
typedArray.bit_field.is_backed_by_rab =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment