!1296 处理静态告警

Merge pull request !1296 from 李兴阳/master
This commit is contained in:
openharmony_ci 2024-08-23 08:15:36 +00:00 committed by Gitee
commit 9fa15e05f3
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
11 changed files with 183 additions and 42 deletions

View File

@ -213,8 +213,8 @@ static vector<uint8_t> GetArray(napi_env env, napi_value arr)
vector<uint8_t> vec;
for (size_t i = 0; i < length; i++) {
napi_get_element(env, arr, i, &napiNumber);
int32_t num = 0;
napi_get_value_int32(env, napiNumber, &num);
uint32_t num = 0;
napi_get_value_uint32(env, napiNumber, &num);
// 255 : the max number of one byte unsigned value
num = num & 0xFF;
vec.push_back(num);
@ -233,7 +233,7 @@ static void freeBolbMemory(Blob *&blob)
static napi_value BlobConstructor(napi_env env, napi_callback_info info)
{
napi_value thisVar = nullptr;
Blob *blob = new Blob();
Blob *blob = new (std::nothrow) Blob();
if (blob == nullptr) {
return nullptr;
}
@ -351,7 +351,11 @@ static bool InitAnyArrayBuffer(napi_env env, napi_value* argv, Buffer *&buffer)
static Buffer* BufferConstructorInner(napi_env env, size_t argc, napi_value* argv, ParaType paraType)
{
Buffer *buffer = new Buffer();
Buffer *buffer = new (std::nothrow) Buffer();
if (buffer == nullptr) {
HILOG_ERROR("BufferStructor:: buffer is nullptr");
return nullptr;
}
uint32_t length = 0;
if (paraType == ParaType::NUMBER) {
if (napi_get_value_uint32(env, argv[1], &length) != napi_ok) {
@ -643,9 +647,9 @@ static napi_value GetBufferData(napi_env env, napi_callback_info info)
Buffer *buf = nullptr;
NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast<void **>(&buf)));
uint32_t length = buf->GetLength();
uint8_t* data = new uint8_t[length];
uint8_t* data = new (std::nothrow) uint8_t[length];
if (data == nullptr) {
HILOG_ERROR("buffer:: data is NULL");
HILOG_ERROR("buffer:: data is nullptr");
return result;
}
buf->ReadBytes(data, 0, length);
@ -1051,7 +1055,11 @@ static void CopiedBlobToArrayBuffer(napi_env env, napi_status status, void *data
static napi_value ArrayBufferAsync(napi_env env, napi_callback_info info)
{
napi_value thisVar = nullptr;
PromiseInfo *promiseInfo = new PromiseInfo();
PromiseInfo *promiseInfo = new (std::nothrow) PromiseInfo();
if (promiseInfo == nullptr) {
HILOG_ERROR("buffer:: promiseInfo is nullptr");
return nullptr;
}
napi_value resourceName = nullptr;
NAPI_CALL(env, napi_get_cb_info(env, info, nullptr, nullptr, &thisVar, nullptr));
Blob *blob = nullptr;
@ -1074,7 +1082,11 @@ static napi_value ArrayBufferAsync(napi_env env, napi_callback_info info)
static napi_value TextAsync(napi_env env, napi_callback_info info)
{
napi_value thisVar = nullptr;
PromiseInfo *promiseInfo = new PromiseInfo();
PromiseInfo *promiseInfo = new (std::nothrow) PromiseInfo();
if (promiseInfo == nullptr) {
HILOG_ERROR("buffer:: promiseInfo is nullptr");
return nullptr;
}
napi_value resourceName = nullptr;
NAPI_CALL(env, napi_get_cb_info(env, info, nullptr, nullptr, &thisVar, nullptr));
Blob *blob = nullptr;

View File

@ -67,11 +67,23 @@ namespace OHOS::Url {
return;
}
std::string base = tempType;
object = new URL(input, base);
object = new (std::nothrow) URL(input, base);
if (object == nullptr) {
HILOG_ERROR("UrlStructor:: object is nullptr");
return;
}
} else if (valuetype2 == napi_object) {
URL *tempUrl = nullptr;
napi_unwrap(env, argv[1], reinterpret_cast<void**>(&tempUrl));
object = new URL(input, *tempUrl);
if (tempUrl == nullptr) {
HILOG_ERROR("UrlStructor:: tempUrl is nullptr");
return;
}
object = new (std::nothrow) URL(input, *tempUrl);
if (object == nullptr) {
HILOG_ERROR("UrlStructor:: object is nullptr");
return;
}
} else {
HILOG_INFO("secondParameter error");
}
@ -563,6 +575,9 @@ namespace OHOS::Url {
}
URLSearchParams *object = nullptr;
napi_unwrap(env, thisVar, reinterpret_cast<void**>(&object));
if (object == nullptr) {
return nullptr;
}
napi_value result = object->Get(env, args);
return result;
}
@ -579,6 +594,9 @@ namespace OHOS::Url {
}
URLSearchParams *object = nullptr;
napi_unwrap(env, thisVar, reinterpret_cast<void**>(&object));
if (object == nullptr) {
return nullptr;
}
napi_value result = object->GetAll(env, args);
return result;
}
@ -596,6 +614,9 @@ namespace OHOS::Url {
}
URLSearchParams *object = nullptr;
napi_unwrap(env, thisVar, reinterpret_cast<void**>(&object));
if (object == nullptr) {
return nullptr;
}
object->Append(env, args[0], args[1]);
return nullptr;
}
@ -612,6 +633,9 @@ namespace OHOS::Url {
}
URLSearchParams *object = nullptr;
napi_unwrap(env, thisVar, reinterpret_cast<void**>(&object));
if (object == nullptr) {
return nullptr;
}
object->Delete(env, args);
return nullptr;
}
@ -624,6 +648,9 @@ namespace OHOS::Url {
napi_get_cb_info(env, info, &argc, &args, &thisVar, nullptr);
URLSearchParams *object = nullptr;
napi_unwrap(env, thisVar, reinterpret_cast<void**>(&object));
if (object == nullptr) {
return nullptr;
}
napi_value result = object->Entries(env);
return result;
}
@ -648,6 +675,9 @@ namespace OHOS::Url {
napi_get_cb_info(env, info, &argc, args, &thisVar, nullptr);
URLSearchParams *object = nullptr;
napi_unwrap(env, thisVar, reinterpret_cast<void**>(&object));
if (object == nullptr) {
return nullptr;
}
object->Set(env, args[0], args[1]);
return nullptr;
}
@ -660,6 +690,9 @@ namespace OHOS::Url {
napi_get_cb_info(env, info, &argc, &args, &thisVar, nullptr);
URLSearchParams *object = nullptr;
napi_unwrap(env, thisVar, reinterpret_cast<void**>(&object));
if (object == nullptr) {
return nullptr;
}
object->Sort();
return nullptr;
}
@ -672,6 +705,9 @@ namespace OHOS::Url {
napi_get_cb_info(env, info, &argc, &args, &thisVar, nullptr);
URLSearchParams *object = nullptr;
napi_unwrap(env, thisVar, reinterpret_cast<void**>(&object));
if (object == nullptr) {
return nullptr;
}
napi_value result = object->IterByKeys(env);
return result;
}
@ -684,6 +720,9 @@ namespace OHOS::Url {
napi_get_cb_info(env, info, &argc, &args, &thisVar, nullptr);
URLSearchParams *object = nullptr;
napi_unwrap(env, thisVar, reinterpret_cast<void**>(&object));
if (object == nullptr) {
return nullptr;
}
napi_value result = object->IterByValues(env);
return result;
}

View File

@ -36,7 +36,7 @@ const std::string SENDABLE_UINT8_CLAMPED_ARRAY = "SendableUint8ClampedArray";
const std::string SENDABLE_FLOAT32_ARRAY = "SendableFloat32Array";
} // namespace
static bool GetCollectionFunction(napi_env env, napi_value global, std::string collectionName,
static bool GetCollectionFunction(napi_env env, napi_value global, const std::string collectionName,
napi_value &collectionFunction)
{
napi_value collectionKey;

View File

@ -111,7 +111,11 @@ namespace OHOS::Util {
outputLen += TRAGET_FOUR;
}
if (outputLen > 0) {
ret = new unsigned char[outputLen + 1];
ret = new (std::nothrow) unsigned char[outputLen + 1];
if (ret == nullptr) {
HILOG_ERROR("Base64:: ret is nullptr");
return nullptr;
}
if (memset_s(ret, outputLen + 1, '\0', outputLen + 1) != EOK) {
HILOG_ERROR("encode ret memset_s failed");
FreeMemory(ret);
@ -130,9 +134,7 @@ namespace OHOS::Util {
flag = true;
}
const char *searchArray = flag ? BASEURL : BASE;
unsigned char *result = nullptr;
result = EncodeAchieveInner(input, ret, searchArray, inputLen, valueType);
unsigned char *result = EncodeAchieveInner(input, ret, searchArray, inputLen, valueType);
return result;
}
@ -207,7 +209,11 @@ namespace OHOS::Util {
size_t prolen = 0;
napi_get_value_string_utf8(env, src, nullptr, 0, &prolen);
if (prolen > 0) {
inputString = new char[prolen + 1];
inputString = new (std::nothrow) char[prolen + 1];
if (inputString == nullptr) {
HILOG_ERROR("inputString is nullptr");
return false;
}
if (memset_s(inputString, prolen + 1, '\0', prolen + 1) != EOK) {
FreeMemory(inputString);
napi_throw_error(env, "-1", "decode inputString memset_s failed");
@ -248,7 +254,11 @@ namespace OHOS::Util {
}
retLen = DecodeOut(equalCount, retLen);
if (retLen > 0) {
retDecode = new unsigned char[retLen + 1];
retDecode = new (std::nothrow) unsigned char[retLen + 1];
if (retDecode == nullptr) {
HILOG_ERROR("retDecode is nullptr");
return nullptr;
}
if (memset_s(retDecode, retLen + 1, '\0', retLen + 1) != EOK) {
FreeMemory(retDecode);
napi_throw_error(env, "-1", "decode retDecode memset_s failed");
@ -388,7 +398,11 @@ namespace OHOS::Util {
void Base64::CreateEncodePromise(napi_env env, unsigned char *inputDecode, size_t length, Type valueType)
{
napi_value resourceName = nullptr;
stdEncodeInfo_ = new EncodeInfo();
stdEncodeInfo_ = new (std::nothrow) EncodeInfo();
if (stdEncodeInfo_ == nullptr) {
HILOG_ERROR("stdEncodeInfo_ is nullptr");
return;
}
stdEncodeInfo_->sinputEncode = inputDecode;
stdEncodeInfo_->slength = length;
stdEncodeInfo_->env = env;

View File

@ -101,7 +101,7 @@ napi_value StringDecoder::End(napi_env env)
return resultStr;
}
void StringDecoder::FreedMemory(UChar *pData)
void StringDecoder::FreedMemory(UChar *&pData)
{
if (pData != nullptr) {
delete[] pData;

View File

@ -30,7 +30,7 @@ public:
napi_value End(napi_env env, napi_value src);
napi_value End(napi_env env);
private:
void FreedMemory(UChar *pData);
void FreedMemory(UChar *&pData);
const char* pend_ {};
int pendingLen_ {};
UConverter* conv_ {};

View File

@ -72,7 +72,11 @@ namespace OHOS::Util {
size_t len = limit * sizeof(UChar);
UChar *arr = nullptr;
if (limit > 0) {
arr = new UChar[limit + 1];
arr = new (std::nothrow) UChar[limit + 1];
if (arr == nullptr) {
HILOG_ERROR("decode arr is nullptr");
return nullptr;
}
if (memset_s(arr, len + sizeof(UChar), 0, len + sizeof(UChar)) != EOK) {
HILOG_ERROR("decode arr memset_s failed");
FreedMemory(arr);
@ -125,7 +129,11 @@ namespace OHOS::Util {
size_t len = limit * sizeof(UChar);
UChar *arr = nullptr;
if (limit > 0) {
arr = new UChar[limit + 1]{0};
arr = new (std::nothrow) UChar[limit + 1]{0};
if (arr == nullptr) {
HILOG_DEBUG("arr is nullptr");
return nullptr;
}
} else {
HILOG_DEBUG("limit is error");
return nullptr;
@ -159,7 +167,7 @@ namespace OHOS::Util {
napi_value TextDecoder::GetEncoding(napi_env env) const
{
size_t length = strlen(encStr_.c_str());
size_t length = encStr_.length();
napi_value result = nullptr;
NAPI_CALL(env, napi_create_string_utf8(env, encStr_.c_str(), length, &result));
return result;
@ -210,7 +218,7 @@ namespace OHOS::Util {
ucnv_reset(tranTool_.get());
}
void TextDecoder::FreedMemory(UChar *pData)
void TextDecoder::FreedMemory(UChar *&pData)
{
if (pData != nullptr) {
delete[] pData;

View File

@ -150,7 +150,7 @@ namespace OHOS::Util {
void SetBomFlag(const UChar *arr, const UErrorCode codeFlag, const DecodeArr decArr,
size_t& rstLen, bool& bomFlag);
void SetIgnoreBOM(const UChar *arr, size_t resultLen, bool& bomFlag);
void FreedMemory(UChar *pData);
void FreedMemory(UChar *&pData);
const char* ReplaceNull(void *data, size_t length) const;
napi_value ThrowError(napi_env env, const char* errMessage);
uint32_t label_ {};

View File

@ -181,7 +181,9 @@ std::string GetFormatUUID(const UUID &uuid)
napi_value GetBinaryUUID(napi_env env, bool entropyCache)
{
UUID uuid;
GetUUID(env, entropyCache, uuid);
if (!GetUUID(env, entropyCache, uuid)) {
return nullptr;
}
void *data = nullptr;
napi_value arrayBuffer = nullptr;
size_t bufferSize = sizeof(uuid.elements);

View File

@ -66,7 +66,11 @@ namespace OHOS::Util {
if (length == 0) {
return nullptr;
}
char *type = new char[length + 1];
char *type = new (std::nothrow) char[length + 1];
if (type == nullptr) {
HILOG_ERROR("type is nullptr");
return nullptr;
}
if (memset_s(type, length + 1, '\0', length + 1) != EOK) {
HILOG_ERROR("type memset_s failed");
delete[] type;
@ -165,7 +169,9 @@ namespace OHOS::Util {
i++;
}
}
res = res.substr(0, res.size() - 1);
if (!res.empty()) {
res = res.substr(0, res.size() - 1);
}
napi_value result = nullptr;
napi_create_string_utf8(env, res.c_str(), res.size(), &result);
return result;
@ -180,10 +186,14 @@ namespace OHOS::Util {
static napi_value DealWithFormatString(napi_env env, napi_callback_info info)
{
size_t argc = 1;
size_t requireArgc = 1; // 1:The number of parameters is 1
napi_value argv = nullptr;
napi_get_cb_info(env, info, &argc, 0, nullptr, nullptr);
napi_get_cb_info(env, info, &argc, &argv, nullptr, nullptr);
if (argc < requireArgc) {
return ThrowError(env, "Parameter error. Wrong number of arguments.");
}
std::string format = "";
size_t formatsize = 0;
if (napi_get_value_string_utf8(env, argv, nullptr, 0, &formatsize) != napi_ok) {
@ -201,8 +211,7 @@ namespace OHOS::Util {
static std::string PrintfString(const std::string &format, const std::vector<std::string> &value)
{
std::string printInfo = DealWithPrintf(format, value);
return printInfo;
return DealWithPrintf(format, value);
}
static napi_value Printf(napi_env env, napi_callback_info info)
@ -212,7 +221,11 @@ namespace OHOS::Util {
napi_get_cb_info(env, info, &argc, nullptr, nullptr, nullptr);
napi_value *argv = nullptr;
if (argc > 0) {
argv = new napi_value[argc];
argv = new (std::nothrow) napi_value[argc];
if (argv == nullptr) {
HILOG_ERROR("Printf:: argv is nullptr");
return nullptr;
}
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
std::string format = "";
size_t formatsize = 0;
@ -427,7 +440,11 @@ namespace OHOS::Util {
}
delete []type;
type = nullptr;
auto objectInfo = new TextDecoder(enconding, paraVec);
auto objectInfo = new (std::nothrow) TextDecoder(enconding, paraVec);
if (objectInfo == nullptr) {
HILOG_ERROR("TextDecoder objectInfo is nullptr");
return nullptr;
}
NAPI_CALL(env, napi_wrap(
env, thisVar, objectInfo,
[](napi_env environment, void *data, void *hint) {
@ -455,6 +472,10 @@ namespace OHOS::Util {
bool iStream = false;
TextDecoder *textDecoder = nullptr;
napi_unwrap(env, thisVar, (void**)&textDecoder);
if (textDecoder == nullptr) {
HILOG_ERROR("DecodeToString::textDecoder is nullptr");
return nullptr;
}
napi_value valStr = nullptr;
if (tempArgc == 1) {
argc = 1;
@ -504,6 +525,9 @@ namespace OHOS::Util {
bool iStream = false;
TextDecoder *textDecoder = nullptr;
napi_unwrap(env, thisVar, (void**)&textDecoder);
if (textDecoder == nullptr) {
return nullptr;
}
napi_value valStr = nullptr;
if (tempArgc == 1) {
argc = 1;
@ -621,7 +645,11 @@ namespace OHOS::Util {
encoding = buffer;
}
}
auto object = new TextEncoder(encoding);
auto object = new (std::nothrow) TextEncoder(encoding);
if (object == nullptr) {
HILOG_ERROR("TextEncoder:: object is nullptr");
return nullptr;
}
object->SetOrgEncoding(orgEncoding);
object->SetApiIsolated(env);
napi_wrap(
@ -738,9 +766,13 @@ namespace OHOS::Util {
static napi_value EncodeIntoUint8Array(napi_env env, napi_callback_info info)
{
napi_value thisVar = nullptr;
size_t requireArgc = 2; // 2:The number of parameters is 2
size_t argc = 2; // 2:The number of parameters is 2
napi_value args[2] = { nullptr }; // 2:The number of parameters is 2
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, &thisVar, nullptr));
if (argc < requireArgc) {
return ThrowError(env, "Parameter error. Wrong number of arguments.");
}
napi_valuetype valuetype0;
NAPI_CALL(env, napi_typeof(env, args[0], &valuetype0));
napi_typedarray_type valuetype1;
@ -767,7 +799,7 @@ namespace OHOS::Util {
size_t argc = 0;
napi_value args[2] = { nullptr }; // 2:The number of parameters is 2
napi_get_cb_info(env, info, &argc, args, &thisVar, nullptr);
if (argc == 2 || argc >= 2) { // 2:The number of parameters is 2
if (argc >= 2) { // 2:The number of parameters is 2
return EncodeIntoTwo(env, info);
}
return EncodeIntoOne(env, info);
@ -993,10 +1025,14 @@ namespace OHOS::Util {
static napi_value EncodeToStringHelper(napi_env env, napi_callback_info info)
{
size_t argc = 2;
size_t argc = 2; // 2:The number of parameters is 2
size_t requireArgc = 2; // 2:The number of parameters is 2
napi_value args[2] = { nullptr };
napi_value thisVar = nullptr;
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, &thisVar, nullptr));
if (argc < requireArgc) {
return ThrowError(env, "Parameter error. Wrong number of arguments.");
}
int32_t encode = 0;
NAPI_CALL(env, napi_get_value_int32(env, args[1], &encode));
Type typeValue = static_cast<Type>(encode);
@ -1011,10 +1047,14 @@ namespace OHOS::Util {
static napi_value EncodeBase64Helper(napi_env env, napi_callback_info info)
{
size_t argc = 2;
size_t argc = 2; // 2:The number of parameters is 2
size_t requireArgc = 2; // 2:The number of parameters is 2
napi_value args[2] = { nullptr };
napi_value thisVar = nullptr;
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, &thisVar, nullptr));
if (argc < requireArgc) {
return ThrowError(env, "Parameter error. Wrong number of arguments.");
}
int32_t encode = 0;
NAPI_CALL(env, napi_get_value_int32(env, args[1], &encode));
Type typeValue = static_cast<Type>(encode);
@ -1028,11 +1068,14 @@ namespace OHOS::Util {
static napi_value EncodeAsyncHelper(napi_env env, napi_callback_info info)
{
size_t argc = 2;
size_t argc = 2; // 2:The number of parameters is 2
size_t requireArgc = 2; // 2:The number of parameters is 2
napi_value args[2] = { nullptr };
napi_value thisVar = nullptr;
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, &thisVar, nullptr));
if (argc < requireArgc) {
return ThrowError(env, "Parameter error. Wrong number of arguments.");
}
int32_t encode = 0;
NAPI_CALL(env, napi_get_value_int32(env, args[1], &encode));
Type typeValue = static_cast<Type>(encode);
@ -1043,10 +1086,14 @@ namespace OHOS::Util {
static napi_value EncodeToStringAsyncHelper(napi_env env, napi_callback_info info)
{
size_t argc = 2;
size_t argc = 2; // 2:The number of parameters is 2
size_t requireArgc = 2; // 2:The number of parameters is 2
napi_value args[2] = { nullptr };
napi_value thisVar = nullptr;
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, &thisVar, nullptr));
if (argc < requireArgc) {
return ThrowError(env, "Parameter error. Wrong number of arguments.");
}
int32_t encode = 0;
NAPI_CALL(env, napi_get_value_int32(env, args[1], &encode));
Type typeValue = static_cast<Type>(encode);
@ -1058,11 +1105,14 @@ namespace OHOS::Util {
static napi_value DecodeBase64Helper(napi_env env, napi_callback_info info)
{
size_t argc = 2;
size_t argc = 2; // 2:The number of parameters is 2
size_t requireArgc = 2; // 2:The number of parameters is 2
napi_value args[2] = { nullptr };
napi_value thisVar = nullptr;
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, &thisVar, nullptr));
if (argc < requireArgc) {
return ThrowError(env, "Parameter error. Wrong number of arguments.");
}
int32_t encode = 0;
NAPI_CALL(env, napi_get_value_int32(env, args[1], &encode));
Type typeValue = static_cast<Type>(encode);
@ -1077,10 +1127,14 @@ namespace OHOS::Util {
static napi_value DecodeAsyncHelper(napi_env env, napi_callback_info info)
{
size_t argc = 2;
size_t argc = 2; // 2:The number of parameters is 2
size_t requireArgc = 2; // 2:The number of parameters is 2
napi_value args[2] = { nullptr };
napi_value thisVar = nullptr;
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, &thisVar, nullptr));
if (argc < requireArgc) {
return ThrowError(env, "Parameter error. Wrong number of arguments.");
}
int32_t encode = 0;
NAPI_CALL(env, napi_get_value_int32(env, args[1], &encode));
Type typeValue = static_cast<Type>(encode);

View File

@ -257,6 +257,10 @@ namespace Commonlibrary::Platform {
outLen = static_cast<size_t>(GetMaxByteSize(encoding)) * inputSize;
napi_create_arraybuffer(env, outLen, &data, arrayBuffer);
char *writeResult = static_cast<char*>(data);
if (writeResult == nullptr) {
HILOG_ERROR("textencoder::writeResult is nullptr");
return;
}
std::string buffer = "";
std::u16string originalStr(originalBuffer, inputSize);
size_t shifting = 0;
@ -319,6 +323,10 @@ namespace Commonlibrary::Platform {
size_t inputSize = 0;
napi_get_value_string_utf16(encodeInfo.env, encodeInfo.src, nullptr, 0, &inputSize);
char16_t *originalBuffer = ApplyMemory(inputSize);
if (originalBuffer == nullptr) {
HILOG_ERROR("textencoder::originalBuffer is nullptr");
return;
}
napi_get_value_string_utf16(encodeInfo.env, encodeInfo.src, originalBuffer, inputSize + 1, &inputSize);
std::vector<char16_t> targetBuffer(inputSize + 1, u'\0');
@ -351,6 +359,10 @@ namespace Commonlibrary::Platform {
size_t inputSize = 0;
napi_get_value_string_utf16(encodeInfo.env, encodeInfo.src, nullptr, 0, &inputSize);
char16_t *originalBuffer = ApplyMemory(inputSize);
if (originalBuffer == nullptr) {
HILOG_ERROR("textencoder::originalBuffer is nullptr");
return;
}
napi_get_value_string_utf16(encodeInfo.env, encodeInfo.src, originalBuffer, inputSize + 1, &inputSize);
size_t writableSize = length;