@homeofthings/sqlite3 6.1.0 → 6.2.0

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/binding.gyp CHANGED
@@ -8,14 +8,10 @@
8
8
  "targets": [
9
9
  {
10
10
  "target_name": "<(module_name)",
11
- "cflags!": [ "-fno-exceptions" ],
12
- "cflags_cc!": [ "-fno-exceptions" ],
13
- "xcode_settings": { "GCC_ENABLE_CPP_EXCEPTIONS": "YES",
11
+ "xcode_settings": {
14
12
  "CLANG_CXX_LIBRARY": "libc++",
15
13
  "MACOSX_DEPLOYMENT_TARGET": "10.7",
16
- },
17
- "msvs_settings": {
18
- "VCCLCompilerTool": { "ExceptionHandling": 1 },
14
+ "OTHER_CFLAGS": [ "-fstack-protector-strong" ]
19
15
  },
20
16
  "include_dirs": [
21
17
  "<!@(node -p \"require('node-addon-api').include\")"],
@@ -40,11 +36,32 @@
40
36
  },
41
37
  {
42
38
  "dependencies": [
43
- "<!(node -p \"require('node-addon-api').gyp\")",
39
+ "<!(node -p \"require('node-addon-api').targets\"):node_addon_api_except",
44
40
  "deps/sqlite3.gyp:sqlite3"
45
41
  ]
46
42
  }
47
- ]
43
+ ],
44
+ # Linux hardening flags (apply to all builds)
45
+ ["OS=='linux'", {
46
+ "cflags+": [
47
+ "-fstack-protector-strong",
48
+ "-fPIC"
49
+ ],
50
+ "ldflags+": [ "-Wl,-z,relro,-z,now" ]
51
+ }],
52
+ # Windows hardening flags (apply to all builds)
53
+ ["OS=='win'", {
54
+ "msvs_settings": {
55
+ "VCCLCompilerTool": {
56
+ "ExceptionHandling": 1,
57
+ "BufferSecurityCheck": "true",
58
+ "ControlFlowGuard": "Guard"
59
+ },
60
+ "VCLinkerTool": {
61
+ "AdditionalOptions": [ "/DYNAMICBASE", "/NXCOMPAT" ]
62
+ }
63
+ }
64
+ }]
48
65
  ],
49
66
  "sources": [
50
67
  "src/backup.cc",
@@ -52,7 +69,29 @@
52
69
  "src/node_sqlite3.cc",
53
70
  "src/statement.cc"
54
71
  ],
55
- "defines": [ "NAPI_VERSION=<(napi_build_version)", "NAPI_DISABLE_CPP_EXCEPTIONS=1" ]
72
+ "defines": [ "NAPI_VERSION=<(napi_build_version)" ],
73
+ # Release-specific hardening flags
74
+ "configurations": {
75
+ "Release": {
76
+ "conditions": [
77
+ # _FORTIFY_SOURCE applies to all Linux architectures
78
+ ["OS=='linux'", {
79
+ "defines+": [ "_FORTIFY_SOURCE=2" ]
80
+ }],
81
+ # Control Flow Protection only for x86_64 (Intel CET)
82
+ ["OS=='linux' and target_arch=='x64'", {
83
+ "cflags+": [ "-fcf-protection=full" ]
84
+ }],
85
+ ["OS=='win'", {
86
+ "msvs_settings": {
87
+ "VCCLCompilerTool": {
88
+ "AdditionalOptions": [ "/sdl" ]
89
+ }
90
+ }
91
+ }]
92
+ ]
93
+ }
94
+ }
56
95
  }
57
96
  ]
58
97
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@homeofthings/sqlite3",
3
3
  "description": "Asynchronous, non-blocking SQLite3 bindings",
4
- "version": "6.1.0",
4
+ "version": "6.2.0",
5
5
  "homepage": "https://github.com/gms1/node-sqlite3",
6
6
  "author": {
7
7
  "name": "Mapbox",
@@ -52,7 +52,8 @@
52
52
  "devDependencies": {
53
53
  "eslint": "8.56.0",
54
54
  "mocha": "10.2.0",
55
- "prebuild": "13.0.1"
55
+ "prebuild": "13.0.1",
56
+ "tinybench": "^2.9.0"
56
57
  },
57
58
  "peerDependencies": {
58
59
  "node-gyp": "12.x"
@@ -73,6 +74,8 @@
73
74
  "prebuild": "prebuild --runtime napi --all --verbose",
74
75
  "rebuild": "node-gyp rebuild",
75
76
  "upload": "prebuild --verbose --prerelease",
77
+ "frozen-install": "yarn install --frozen-lockfile",
78
+ "lint": "eslint .eslintrc.js lib/ test/ tools/",
76
79
  "test": "node test/support/createdb.js && mocha -R spec --timeout 480000"
77
80
  },
78
81
  "license": "BSD-3-Clause",
package/src/statement.h CHANGED
@@ -57,7 +57,9 @@ namespace Values {
57
57
  Field(_name, SQLITE_BLOB), length(len) {
58
58
  value = new char[len];
59
59
  assert(value != nullptr);
60
- memcpy(value, val, len);
60
+ if (len > 0) {
61
+ memcpy(value, val, len);
62
+ }
61
63
  }
62
64
  inline virtual ~Blob() override {
63
65
  delete[] value;