koffi 2.8.7 → 2.8.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/build/koffi/darwin_arm64/koffi.node +0 -0
- package/build/koffi/darwin_x64/koffi.node +0 -0
- package/build/koffi/freebsd_arm64/koffi.node +0 -0
- package/build/koffi/freebsd_ia32/koffi.node +0 -0
- package/build/koffi/freebsd_x64/koffi.node +0 -0
- package/build/koffi/linux_arm32hf/koffi.node +0 -0
- package/build/koffi/linux_arm64/koffi.node +0 -0
- package/build/koffi/linux_ia32/koffi.node +0 -0
- package/build/koffi/linux_riscv64hf64/koffi.node +0 -0
- package/build/koffi/linux_x64/koffi.node +0 -0
- package/build/koffi/openbsd_ia32/koffi.node +0 -0
- package/build/koffi/openbsd_x64/koffi.node +0 -0
- package/build/koffi/win32_arm64/koffi.node +0 -0
- package/build/koffi/win32_ia32/koffi.node +0 -0
- package/build/koffi/win32_x64/koffi.node +0 -0
- package/index.js +2 -2
- package/indirect.js +2 -2
- package/package.json +2 -2
- package/src/koffi/src/call.cc +6 -14
- package/src/koffi/src/call.hh +1 -1
- package/src/koffi/src/util.cc +1 -3
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
### Koffi 2.8
|
|
6
6
|
|
|
7
|
+
#### Koffi 2.8.8 (2024-04-26)
|
|
8
|
+
|
|
9
|
+
- Support use of buffers with mismatched size (truncation or zero-filling)
|
|
10
|
+
|
|
7
11
|
#### Koffi 2.8.7 (2024-04-23)
|
|
8
12
|
|
|
9
13
|
- Improve compatibility with SEHOP on Windows ([@longhun12346](https://github.com/longhun12346))
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/index.js
CHANGED
|
@@ -378,8 +378,8 @@ var require_package = __commonJS({
|
|
|
378
378
|
"build/dist/src/koffi/package.json"(exports2, module2) {
|
|
379
379
|
module2.exports = {
|
|
380
380
|
name: "koffi",
|
|
381
|
-
version: "2.8.
|
|
382
|
-
stable: "2.8.
|
|
381
|
+
version: "2.8.8",
|
|
382
|
+
stable: "2.8.8",
|
|
383
383
|
description: "Fast and simple C FFI (foreign function interface) for Node.js",
|
|
384
384
|
keywords: [
|
|
385
385
|
"foreign",
|
package/indirect.js
CHANGED
|
@@ -378,8 +378,8 @@ var require_package = __commonJS({
|
|
|
378
378
|
"build/dist/src/koffi/package.json"(exports2, module2) {
|
|
379
379
|
module2.exports = {
|
|
380
380
|
name: "koffi",
|
|
381
|
-
version: "2.8.
|
|
382
|
-
stable: "2.8.
|
|
381
|
+
version: "2.8.8",
|
|
382
|
+
stable: "2.8.8",
|
|
383
383
|
description: "Fast and simple C FFI (foreign function interface) for Node.js",
|
|
384
384
|
keywords: [
|
|
385
385
|
"foreign",
|
package/package.json
CHANGED
package/src/koffi/src/call.cc
CHANGED
|
@@ -593,9 +593,7 @@ bool CallData::PushObject(Napi::Object obj, const TypeInfo *type, uint8_t *origi
|
|
|
593
593
|
return false;
|
|
594
594
|
} else if (IsRawBuffer(value)) {
|
|
595
595
|
Span<const uint8_t> buffer = GetRawBuffer(value);
|
|
596
|
-
|
|
597
|
-
if (!PushBuffer(buffer, member.type->size, member.type, dest))
|
|
598
|
-
return false;
|
|
596
|
+
PushBuffer(buffer, member.type->size, member.type, dest);
|
|
599
597
|
} else if (value.IsString()) {
|
|
600
598
|
if (!PushStringArray(value, member.type, dest))
|
|
601
599
|
return false;
|
|
@@ -830,9 +828,7 @@ bool CallData::PushNormalArray(Napi::Array array, Size len, const TypeInfo *type
|
|
|
830
828
|
return false;
|
|
831
829
|
} else if (IsRawBuffer(value)) {
|
|
832
830
|
Span<const uint8_t> buffer = GetRawBuffer(value);
|
|
833
|
-
|
|
834
|
-
if (!PushBuffer(buffer, ref->size, ref, dest))
|
|
835
|
-
return false;
|
|
831
|
+
PushBuffer(buffer, ref->size, ref, dest);
|
|
836
832
|
} else if (value.IsString()) {
|
|
837
833
|
if (!PushStringArray(value, ref, dest))
|
|
838
834
|
return false;
|
|
@@ -896,15 +892,13 @@ bool CallData::PushNormalArray(Napi::Array array, Size len, const TypeInfo *type
|
|
|
896
892
|
return true;
|
|
897
893
|
}
|
|
898
894
|
|
|
899
|
-
|
|
895
|
+
void CallData::PushBuffer(Span<const uint8_t> buffer, Size size, const TypeInfo *type, uint8_t *origin)
|
|
900
896
|
{
|
|
901
|
-
|
|
902
|
-
ThrowError<Napi::Error>(env, "Expected array or buffer of size %1, got %2", size, buffer.len);
|
|
903
|
-
return false;
|
|
904
|
-
}
|
|
897
|
+
buffer.len = std::min(buffer.len, size);
|
|
905
898
|
|
|
906
|
-
// Go fast
|
|
899
|
+
// Go fast brrrrrrr :)
|
|
907
900
|
memcpy_safe(origin, buffer.ptr, (size_t)buffer.len);
|
|
901
|
+
memset_safe(origin + buffer.len, 0, (size_t)(size - buffer.len));
|
|
908
902
|
|
|
909
903
|
#define SWAP(CType) \
|
|
910
904
|
do { \
|
|
@@ -929,8 +923,6 @@ bool CallData::PushBuffer(Span<const uint8_t> buffer, Size size, const TypeInfo
|
|
|
929
923
|
}
|
|
930
924
|
|
|
931
925
|
#undef SWAP
|
|
932
|
-
|
|
933
|
-
return true;
|
|
934
926
|
}
|
|
935
927
|
|
|
936
928
|
bool CallData::PushStringArray(Napi::Value obj, const TypeInfo *type, uint8_t *origin)
|
package/src/koffi/src/call.hh
CHANGED
|
@@ -119,7 +119,7 @@ public:
|
|
|
119
119
|
Size PushString16Value(Napi::Value value, const char16_t **out_str16);
|
|
120
120
|
bool PushObject(Napi::Object obj, const TypeInfo *type, uint8_t *origin);
|
|
121
121
|
bool PushNormalArray(Napi::Array array, Size len, const TypeInfo *type, uint8_t *origin);
|
|
122
|
-
|
|
122
|
+
void PushBuffer(Span<const uint8_t> buffer, Size size, const TypeInfo *type, uint8_t *origin);
|
|
123
123
|
bool PushStringArray(Napi::Value value, const TypeInfo *type, uint8_t *origin);
|
|
124
124
|
bool PushPointer(Napi::Value value, const TypeInfo *type, int directions, void **out_ptr);
|
|
125
125
|
Size PushIndirectString(Napi::Array array, const TypeInfo *ref, uint8_t **out_ptr);
|
package/src/koffi/src/util.cc
CHANGED
|
@@ -1446,9 +1446,7 @@ bool Encode(Napi::Env env, uint8_t *origin, Napi::Value value, const TypeInfo *t
|
|
|
1446
1446
|
return false;
|
|
1447
1447
|
} else if (IsRawBuffer(value)) {
|
|
1448
1448
|
Span<const uint8_t> buffer = GetRawBuffer(value);
|
|
1449
|
-
|
|
1450
|
-
if (!call.PushBuffer(buffer, type->size, type, origin))
|
|
1451
|
-
return false;
|
|
1449
|
+
call.PushBuffer(buffer, type->size, type, origin);
|
|
1452
1450
|
} else if (value.IsString()) {
|
|
1453
1451
|
if (!call.PushStringArray(value, type, origin))
|
|
1454
1452
|
return false;
|