Fix getting array buffer when building Uint8Array

This commit is contained in:
Saúl Ibarra Corretgé 2023-11-25 00:42:44 +01:00
parent 27287519aa
commit 7776cc3b75

View file

@ -49816,7 +49816,7 @@ static JSValue js_new_uint8array(JSContext *ctx, JSValue buffer)
JS_FreeValue(ctx, buffer); JS_FreeValue(ctx, buffer);
return JS_EXCEPTION; return JS_EXCEPTION;
} }
JSArrayBuffer *abuf = JS_GetOpaque(buffer, JS_CLASS_ARRAY_BUFFER); JSArrayBuffer *abuf = js_get_array_buffer(ctx, buffer);
assert(abuf != NULL); assert(abuf != NULL);
if (typed_array_init(ctx, obj, buffer, 0, abuf->byte_length)) { if (typed_array_init(ctx, obj, buffer, 0, abuf->byte_length)) {
// 'buffer' is freed on error above. // 'buffer' is freed on error above.