diff --git a/ecmascript/builtins/builtins_typedarray.cpp b/ecmascript/builtins/builtins_typedarray.cpp index dec628b8449039aedf6015cb879529c47e718001..ad02c9e885b680614be10345aa3a9ac930185036 100644 --- a/ecmascript/builtins/builtins_typedarray.cpp +++ b/ecmascript/builtins/builtins_typedarray.cpp @@ -1181,6 +1181,13 @@ JSTaggedValue BuiltinsTypedArray::Reverse(EcmaRuntimeCallInfo *argv) lowerValueHandle = JSArray::FastGetPropertyByValue(thread, thisObjVal, lowerP); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); upperValueHandle = JSArray::FastGetPropertyByValue(thread, thisObjVal, upperP); + + JSTaggedValue buffer = JSHandle::Cast(thisObjVal)->GetViewedArrayBufferOrByteArray(); + if (BuiltinsArrayBuffer::IsDetachedBuffer(buffer)) { + THROW_TYPE_ERROR_AND_RETURN(argv->GetThread(), "The ArrayBuffer of typedArray is detached buffer.", + JSTaggedValue::Exception()); + } + JSArray::FastSetPropertyByValue(thread, thisObjVal, lowerP, upperValueHandle); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); JSArray::FastSetPropertyByValue(thread, thisObjVal, upperP, lowerValueHandle);