From 3c58a473b6f78411861215f7ce75f1e0bf695490 Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Sat, 15 Feb 2025 13:31:42 -0500 Subject: [PATCH] Normative: Validate DataView buffer mutability before argument coercion Ref #31 --- spec.emu | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec.emu b/spec.emu index f3ef762..0026413 100644 --- a/spec.emu +++ b/spec.emu @@ -717,6 +717,7 @@ contributors: Mark S. Miller, Richard Gibson 1. Perform ? RequireInternalSlot(_view_, [[DataView]]). 1. Assert: _view_ has a [[ViewedArrayBuffer]] internal slot. + 1. If IsImmutableBuffer(_view_.[[ViewedArrayBuffer]]) is *true*, throw a *TypeError* exception. 1. Let _getIndex_ be ? ToIndex(_requestIndex_). 1. If IsBigIntElementType(_type_) is *true*, let _numberValue_ be ? ToBigInt(_value_). 1. Otherwise, let _numberValue_ be ? ToNumber(_value_). @@ -725,7 +726,6 @@ contributors: Mark S. Miller, Richard Gibson 1. Let _viewRecord_ be MakeDataViewWithBufferWitnessRecord(_view_, ~unordered~). 1. NOTE: Bounds checking is not a synchronizing operation when _view_'s backing buffer is a growable SharedArrayBuffer. 1. If IsViewOutOfBounds(_viewRecord_) is *true*, throw a *TypeError* exception. - 1. If IsImmutableBuffer(_view_.[[ViewedArrayBuffer]]) is *true*, throw a *TypeError* exception. 1. Let _viewSize_ be GetViewByteLength(_viewRecord_). 1. Let _elementSize_ be the Element Size value specified in for Element Type _type_. 1. If _getIndex_ + _elementSize_ > _viewSize_, throw a *RangeError* exception.