Merge 83fa0503121a1363bc3586fe02cb31115b54f06f into d7ae12ae71dfd6ab2997527d295014a8996fa0f9

This commit is contained in:
Jieke 2026-03-28 22:26:51 +08:00 committed by GitHub
commit 4c4fb0ec88
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -56398,7 +56398,8 @@ static JSArrayBuffer *js_get_array_buffer(JSContext *ctx, JSValueConst obj)
}
/* return NULL if exception. WARNING: any JS call can detach the
buffer and render the returned pointer invalid */
buffer and render the returned pointer invalid. psize can be
NULL. */
uint8_t *JS_GetArrayBuffer(JSContext *ctx, size_t *psize, JSValueConst obj)
{
JSArrayBuffer *abuf = js_get_array_buffer(ctx, obj);
@ -56408,10 +56409,14 @@ uint8_t *JS_GetArrayBuffer(JSContext *ctx, size_t *psize, JSValueConst obj)
JS_ThrowTypeErrorDetachedArrayBuffer(ctx);
goto fail;
}
*psize = abuf->byte_length;
if (psize) {
*psize = abuf->byte_length;
}
return abuf->data;
fail:
*psize = 0;
if (psize) {
*psize = 0;
}
return NULL;
}