This commit is contained in:
Jarred Sumner
2023-07-14 18:34:09 -07:00
parent 6924134cd5
commit 1becd014fa
2 changed files with 42 additions and 3 deletions

View File

@@ -1390,7 +1390,7 @@ extern "C" JSC__JSValue Bun__createArrayBufferForCopy(JSC::JSGlobalObject* globa
return JSC::JSValue::encode(JSC::JSValue {});
}
if (len > 0)
if (len > 0 && ptr)
memcpy(arrayBuffer->data(), ptr, len);
RELEASE_AND_RETURN(scope, JSValue::encode(JSC::JSArrayBuffer::create(globalObject->vm(), globalObject->arrayBufferStructure(JSC::ArrayBufferSharingMode::Default), WTFMove(arrayBuffer))));
@@ -1409,7 +1409,7 @@ extern "C" JSC__JSValue Bun__createUint8ArrayForCopy(JSC::JSGlobalObject* global
return JSC::JSValue::encode(JSC::JSValue {});
}
if (len > 0)
if (len > 0 && ptr)
memcpy(array->vector(), ptr, len);
RELEASE_AND_RETURN(scope, JSValue::encode(array));
@@ -4241,7 +4241,6 @@ void GlobalObject::installAPIGlobals(JSClassRef* globals, int count, JSC::VM& vm
JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly);
}
{
JSC::Identifier identifier = JSC::Identifier::fromString(vm, "BrotliCompressorSink"_s);
object->putDirectCustomAccessor(vm, identifier, JSC::CustomGetterSetter::create(vm, functionBrotliCompressorSink__getter, nullptr),

View File

@@ -714,6 +714,46 @@ ZIG_DECL JSC__JSValue FileSink__start(JSC__JSGlobalObject* arg0, JSC__CallFrame*
ZIG_DECL void FileSink__updateRef(void* arg0, bool arg1);
ZIG_DECL JSC__JSValue FileSink__write(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1);
#endif
CPP_DECL JSC__JSValue BrotliDecompressorSink__assignToStream(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1, void* arg2, void** arg3);
CPP_DECL JSC__JSValue BrotliDecompressorSink__createObject(JSC__JSGlobalObject* arg0, void* arg1);
CPP_DECL void BrotliDecompressorSink__detachPtr(JSC__JSValue JSValue0);
CPP_DECL void* BrotliDecompressorSink__fromJS(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1);
CPP_DECL void BrotliDecompressorSink__onClose(JSC__JSValue JSValue0, JSC__JSValue JSValue1);
CPP_DECL void BrotliDecompressorSink__onReady(JSC__JSValue JSValue0, JSC__JSValue JSValue1, JSC__JSValue JSValue2);
#ifdef __cplusplus
ZIG_DECL JSC__JSValue BrotliDecompressorSink__close(JSC__JSGlobalObject* arg0, void* arg1);
ZIG_DECL JSC__JSValue BrotliDecompressorSink__construct(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1);
ZIG_DECL JSC__JSValue BrotliDecompressorSink__end(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1);
ZIG_DECL JSC__JSValue BrotliDecompressorSink__endWithSink(void* arg0, JSC__JSGlobalObject* arg1);
ZIG_DECL void BrotliDecompressorSink__finalize(void* arg0);
ZIG_DECL JSC__JSValue BrotliDecompressorSink__flush(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1);
ZIG_DECL JSC__JSValue BrotliDecompressorSink__start(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1);
ZIG_DECL void BrotliDecompressorSink__updateRef(void* arg0, bool arg1);
ZIG_DECL JSC__JSValue BrotliDecompressorSink__write(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1);
#endif
CPP_DECL JSC__JSValue BrotliCompressorSink__assignToStream(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1, void* arg2, void** arg3);
CPP_DECL JSC__JSValue BrotliCompressorSink__createObject(JSC__JSGlobalObject* arg0, void* arg1);
CPP_DECL void BrotliCompressorSink__detachPtr(JSC__JSValue JSValue0);
CPP_DECL void* BrotliCompressorSink__fromJS(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1);
CPP_DECL void BrotliCompressorSink__onClose(JSC__JSValue JSValue0, JSC__JSValue JSValue1);
CPP_DECL void BrotliCompressorSink__onReady(JSC__JSValue JSValue0, JSC__JSValue JSValue1, JSC__JSValue JSValue2);
#ifdef __cplusplus
ZIG_DECL JSC__JSValue BrotliCompressorSink__close(JSC__JSGlobalObject* arg0, void* arg1);
ZIG_DECL JSC__JSValue BrotliCompressorSink__construct(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1);
ZIG_DECL JSC__JSValue BrotliCompressorSink__end(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1);
ZIG_DECL JSC__JSValue BrotliCompressorSink__endWithSink(void* arg0, JSC__JSGlobalObject* arg1);
ZIG_DECL void BrotliCompressorSink__finalize(void* arg0);
ZIG_DECL JSC__JSValue BrotliCompressorSink__flush(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1);
ZIG_DECL JSC__JSValue BrotliCompressorSink__start(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1);
ZIG_DECL void BrotliCompressorSink__updateRef(void* arg0, bool arg1);
ZIG_DECL JSC__JSValue BrotliCompressorSink__write(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1);
#endif
#ifdef __cplusplus