sqlite3 1.5.0.rc1-arm-linux → 1.5.1-arm-linux

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bb021bcd830b6f8f3f7bcbd34d900c71b7465c9edc290d654c574af9db56225b
4
- data.tar.gz: 489bb2ed0b97919def407d11d9563a23148ef6c471ff254bccf8149217d729b5
3
+ metadata.gz: 2e02b39f3b51452495371649b0a3e88fd1922bed9af7005853cb867d590ec7bf
4
+ data.tar.gz: 86ffa40979adc438cc018df0b32a40f4a46e5a735287388f5c3d4f62fad4636f
5
5
  SHA512:
6
- metadata.gz: 306f49ab8ac6b987891e9d3dd8c16e59cb91cf44e4b8087bc7c819aa699791d9ef2d44566cd10e4bdd9728ccc1c20c87ee7f777317c600f31a9b34625ed7a6d7
7
- data.tar.gz: 568912cab905969a2d65082bce1e32eceaaaa6eb3a66204a3228a0d834388093b8ecb5445614cdeb33744aae05c16ba0494d6c2fece87cf9c27f092c49756c83
6
+ metadata.gz: f6a8ef59b93767f400c94cd4450e3f4e42399d9b66b31e4d45b95c725c6cce0cb2cbd00267e47ee64afce82952a485925f8567b0b500d4fcb5873a2ca19eac99
7
+ data.tar.gz: 5d1a8712491ce3d99e5116dee9679a11fd9fffa9f9709faa719e5374df5eb5527a502b8978e3b56c403cde9967c9ce2bbc22c6926ca2ae3f0697d62456e0b5be
data/CHANGELOG.md CHANGED
@@ -1,6 +1,27 @@
1
1
  # sqlite3-ruby Changelog
2
2
 
3
- ## 1.5.0 / unreleased
3
+ ## 1.5.1 / 2022-09-29
4
+
5
+ ### Dependencies
6
+
7
+ * Vendored sqlite is updated to [v3.39.4](https://sqlite.org/releaselog/3_39_4.html).
8
+
9
+ ### Security
10
+
11
+ The vendored version of sqlite, v3.39.4, should be considered to be a security release. From the release notes:
12
+
13
+ > Version 3.39.4 is a minimal patch against the prior release that addresses issues found since the
14
+ > prior release. In particular, a potential vulnerability in the FTS3 extension has been fixed, so
15
+ > this should be considered a security update.
16
+ >
17
+ > In order to exploit the vulnerability, an attacker must have full SQL access and must be able to
18
+ > construct a corrupt database with over 2GB of FTS3 content. The problem arises from a 32-bit
19
+ > signed integer overflow.
20
+
21
+ For more information please see [GHSA-mgvv-5mxp-xq67](https://github.com/sparklemotion/sqlite3-ruby/security/advisories/GHSA-mgvv-5mxp-xq67).
22
+
23
+
24
+ ## 1.5.0 / 2022-09-08
4
25
 
5
26
  ### Packaging
6
27
 
@@ -23,19 +44,20 @@ See [the README](https://github.com/sparklemotion/sqlite3-ruby#native-gems-recom
23
44
 
24
45
  #### More consistent developer experience
25
46
 
26
- Both the native (precompiled) gems and the vanilla "ruby platform" (source) gem include sqlite v3.39.0 by default.
47
+ Both the native (precompiled) gems and the vanilla "ruby platform" (source) gem include sqlite v3.39.3 by default.
27
48
 
28
49
  Defaulting to a consistent version of sqlite across all systems means that your development environment behaves exactly like your production environment, and you have access to the latest and greatest features of sqlite.
29
50
 
30
51
  You can opt-out of the packaged version of sqlite (and use your system-installed library as in versions < 1.5.0). See [the README](https://github.com/sparklemotion/sqlite3-ruby#avoiding-the-precompiled-native-gem) for more information.
31
52
 
32
- [Release notes for this version of sqlite](https://sqlite.org/releaselog/3_39_0.html)
53
+ [Release notes for this version of sqlite](https://sqlite.org/releaselog/3_39_3.html)
33
54
 
34
55
 
35
56
  ### Rubies and Platforms
36
57
 
37
58
  * TruffleRuby is supported.
38
59
  * Apple Silicon is supported (M1, arm64-darwin).
60
+ * vcpkg system libraries supported. [#332] (Thanks, @MSP-Greg!)
39
61
 
40
62
 
41
63
  ### Added
@@ -43,6 +65,11 @@ You can opt-out of the packaged version of sqlite (and use your system-installed
43
65
  * `SQLite3::SQLITE_LOADED_VERSION` contains the version string of the sqlite3 library that is dynamically loaded (compare to `SQLite3::SQLITE_VERSION` which is the version at compile-time).
44
66
 
45
67
 
68
+ ### Fixed
69
+
70
+ * `SQLite3::Database#load_extensions` now raises a `TypeError` unless a String is passed as the file path. Previously it was possible to pass a non-string and cause a segfault. [#339]
71
+
72
+
46
73
  ## 1.4.4 / 2022-06-14
47
74
 
48
75
  ### Fixes
data/README.md CHANGED
@@ -107,7 +107,8 @@ If you're on a platform that supports a native gem but you want to avoid using i
107
107
 
108
108
  - If you're not using Bundler, then run `gem install sqlite3 --platform=ruby`
109
109
  - If you are using Bundler
110
- - version 2.1 or later, then you'll need to run `bundle config set force_ruby_platform true`,
110
+ - version 2.3.18 or later, you can specify [`gem "sqlite3", force_ruby_platform: true`](https://bundler.io/v2.3/man/gemfile.5.html#FORCE_RUBY_PLATFORM)
111
+ - version 2.1 or later, then you'll need to run `bundle config set force_ruby_platform true`
111
112
  - version 2.0 or earlier, then you'll need to run `bundle config force_ruby_platform true`
112
113
 
113
114
 
@@ -118,7 +119,7 @@ If you are on a platform or version of Ruby that is not covered by the Native Ge
118
119
 
119
120
  #### Packaged libsqlite3
120
121
 
121
- By default, as of v1.5.0 of this library, libsqlite3 v3.38.5 is packaged with the gem and will be compiled and used automatically. This takes a bit longer than the native gem, but will provide a modern, well-supported version of libsqlite3.
122
+ By default, as of v1.5.0 of this library, the latest available version of libsqlite3 is packaged with the gem and will be compiled and used automatically. This takes a bit longer than the native gem, but will provide a modern, well-supported version of libsqlite3.
122
123
 
123
124
  For example, on a linux system running Ruby 2.5:
124
125
 
@@ -143,6 +144,7 @@ If you would prefer to build the sqlite3-ruby gem against your system libsqlite3
143
144
 
144
145
  PLEASE NOTE:
145
146
 
147
+ - you must avoid installing a precompiled native gem (see [previous section](#avoiding-the-precompiled-native-gem))
146
148
  - only versions of libsqlite3 `>= 3.5.0` are supported,
147
149
  - and some library features may depend on how your libsqlite3 was compiled.
148
150
 
@@ -265,9 +265,10 @@ rb_sqlite3_define_aggregator2(VALUE self, VALUE aggregator, VALUE ruby_name)
265
265
  void
266
266
  rb_sqlite3_aggregator_init(void)
267
267
  {
268
- rb_gc_register_address(&cAggregatorWrapper);
269
- rb_gc_register_address(&cAggregatorInstance);
270
268
  /* rb_class_new generatos class with undefined allocator in ruby 1.9 */
271
269
  cAggregatorWrapper = rb_funcall(rb_cClass, rb_intern("new"), 0);
270
+ rb_gc_register_mark_object(cAggregatorWrapper);
271
+
272
272
  cAggregatorInstance = rb_funcall(rb_cClass, rb_intern("new"), 0);
273
+ rb_gc_register_mark_object(cAggregatorInstance);
273
274
  }
@@ -31,7 +31,7 @@ static char *
31
31
  utf16_string_value_ptr(VALUE str)
32
32
  {
33
33
  StringValue(str);
34
- rb_str_buf_cat(str, "\x00", 1L);
34
+ rb_str_buf_cat(str, "\x00\x00", 2L);
35
35
  return RSTRING_PTR(str);
36
36
  }
37
37
 
@@ -603,7 +603,7 @@ static VALUE load_extension(VALUE self, VALUE file)
603
603
  Data_Get_Struct(self, sqlite3Ruby, ctx);
604
604
  REQUIRE_OPEN_DB(ctx);
605
605
 
606
- status = sqlite3_load_extension(ctx->db, RSTRING_PTR(file), 0, &errMsg);
606
+ status = sqlite3_load_extension(ctx->db, StringValuePtr(file), 0, &errMsg);
607
607
  if (status != SQLITE_OK)
608
608
  {
609
609
  errexp = rb_exc_new2(rb_eRuntimeError, errMsg);
@@ -36,19 +36,26 @@ module Sqlite3
36
36
  end
37
37
 
38
38
  def sqlcipher?
39
- with_config("sqlcipher")
39
+ with_config("sqlcipher") ||
40
+ with_config("sqlcipher-dir") ||
41
+ with_config("sqlcipher-include") ||
42
+ with_config("sqlcipher-lib")
40
43
  end
41
44
 
42
45
  def configure_system_libraries
43
46
  pkg_config(libname)
44
- append_cflags("-DUSING_SQLCIPHER") if sqlcipher?
47
+ append_cppflags("-DUSING_SQLCIPHER") if sqlcipher?
45
48
  end
46
49
 
47
50
  def configure_packaged_libraries
48
51
  minimal_recipe.tap do |recipe|
49
52
  recipe.configure_options += ["--enable-shared=no", "--enable-static=yes"]
50
53
  ENV.to_h.tap do |env|
51
- env["CFLAGS"] = [env["CFLAGS"], "-fPIC"].join(" ") # needed for linking the static library into a shared library
54
+ additional_cflags = [
55
+ "-fPIC", # needed for linking the static library into a shared library
56
+ "-O2", # see https://github.com/sparklemotion/sqlite3-ruby/issues/335 for some benchmarks
57
+ ]
58
+ env["CFLAGS"] = [env["CFLAGS"], additional_cflags].flatten.join(" ")
52
59
  recipe.configure_options += env.select { |k,v| ENV_ALLOWLIST.include?(k) }
53
60
  .map { |key, value| "#{key}=#{value.strip}" }
54
61
  end
@@ -72,10 +79,17 @@ module Sqlite3
72
79
 
73
80
  def configure_extension
74
81
  if Gem::Requirement.new("< 2.7").satisfied_by?(Gem::Version.new(RUBY_VERSION))
75
- append_cflags("-DTAINTING_SUPPORT")
82
+ append_cppflags("-DTAINTING_SUPPORT")
83
+ end
84
+
85
+ if find_header("sqlite3.h")
86
+ # noop
87
+ elsif sqlcipher? && find_header("sqlcipher/sqlite3.h")
88
+ append_cppflags("-DUSING_SQLCIPHER_INC_SUBDIR")
89
+ else
90
+ abort_could_not_find("sqlite3.h")
76
91
  end
77
92
 
78
- abort_could_not_find("sqlite3.h") unless find_header("sqlite3.h")
79
93
  abort_could_not_find(libname) unless find_library(libname, "sqlite3_libversion_number", "sqlite3.h")
80
94
 
81
95
  # Functions defined in 1.9 but not 1.8
@@ -119,18 +133,18 @@ module Sqlite3
119
133
  def mini_portile_config
120
134
  {
121
135
  sqlite3: {
122
- # checksum verified by first checking the published sha3(256) checksum:
136
+ # checksum verified by first checking the published sha3(256) checksum against https://sqlite.org/download.html:
123
137
  #
124
- # $ sha3sum -a 256 sqlite-autoconf-3390000.tar.gz
125
- # b8e5b3265992350d40c4ad31efc2e6dec6256813f1d5acc8f0ea805e9f33ca2a sqlite-autoconf-3390000.tar.gz
138
+ # $ sha3sum -a 256 ports/archives/sqlite-autoconf-3390400.tar.gz
139
+ # 431328e30d12c551da9ba7ef2122b269076058512014afa799caaf62ca567090 ports/archives/sqlite-autoconf-3390400.tar.gz
126
140
  #
127
- # $ sha256sum sqlite-autoconf-3390000.tar.gz
128
- # e90bcaef6dd5813fcdee4e867f6b65f3c9bfd0aec0f1017f9f3bbce1e4ed09e2 sqlite-autoconf-3390000.tar.gz
141
+ # $ sha256sum ports/archives/sqlite-autoconf-3390400.tar.gz
142
+ # f31d445b48e67e284cf206717cc170ab63cbe4fd7f79a82793b772285e78fdbb ports/archives/sqlite-autoconf-3390400.tar.gz
129
143
  #
130
- version: "3.39.0",
144
+ version: "3.39.4",
131
145
  files: [{
132
- url: "https://www.sqlite.org/2022/sqlite-autoconf-3390000.tar.gz",
133
- sha256: "e90bcaef6dd5813fcdee4e867f6b65f3c9bfd0aec0f1017f9f3bbce1e4ed09e2",
146
+ url: "https://sqlite.org/2022/sqlite-autoconf-3390400.tar.gz",
147
+ sha256: "f31d445b48e67e284cf206717cc170ab63cbe4fd7f79a82793b772285e78fdbb",
134
148
  }],
135
149
  }
136
150
  }
@@ -147,10 +161,89 @@ module Sqlite3
147
161
  def download
148
162
  minimal_recipe.download
149
163
  end
164
+
165
+ def print_help
166
+ print(<<~TEXT)
167
+ USAGE: ruby #{$PROGRAM_NAME} [options]
168
+
169
+ Flags that are always valid:
170
+
171
+ --disable-system-libraries
172
+ Use the packaged libraries, and ignore the system libraries.
173
+ (This is the default behavior.)
174
+
175
+ --enable-system-libraries
176
+ Use system libraries instead of building and using the packaged libraries.
177
+
178
+ --with-sqlcipher
179
+ Use libsqlcipher instead of libsqlite3.
180
+ (Implies `--enable-system-libraries`.)
181
+
182
+ --help
183
+ Display this message.
184
+
185
+
186
+ Flags only used when using system libraries:
187
+
188
+ General (applying to all system libraries):
189
+
190
+ --with-opt-dir=DIRECTORY
191
+ Look for headers and libraries in DIRECTORY.
192
+
193
+ --with-opt-lib=DIRECTORY
194
+ Look for libraries in DIRECTORY.
195
+
196
+ --with-opt-include=DIRECTORY
197
+ Look for headers in DIRECTORY.
198
+
199
+ Related to sqlcipher:
200
+
201
+ --with-sqlcipher-dir=DIRECTORY
202
+ Look for sqlcipher headers and library in DIRECTORY.
203
+ (Implies `--with-sqlcipher` and `--enable-system-libraries`.)
204
+
205
+ --with-sqlcipher-lib=DIRECTORY
206
+ Look for sqlcipher library in DIRECTORY.
207
+ (Implies `--with-sqlcipher` and `--enable-system-libraries`.)
208
+
209
+ --with-sqlcipher-include=DIRECTORY
210
+ Look for sqlcipher headers in DIRECTORY.
211
+ (Implies `--with-sqlcipher` and `--enable-system-libraries`.)
212
+
213
+
214
+ Flags only used when building and using the packaged libraries:
215
+
216
+ --enable-cross-build
217
+ Enable cross-build mode. (You probably do not want to set this manually.)
218
+
219
+
220
+ Environment variables used for compiling the C extension:
221
+
222
+ CC
223
+ Use this path to invoke the compiler instead of `RbConfig::CONFIG['CC']`
224
+
225
+
226
+ Environment variables passed through to the compilation of packaged libraries:
227
+
228
+ CC
229
+ CPPFLAGS
230
+ CFLAGS
231
+ LDFLAGS
232
+ LIBS
233
+ LT_SYS_LIBRARY_PATH
234
+ CPP
235
+
236
+ TEXT
237
+ end
150
238
  end
151
239
  end
152
240
  end
153
241
 
242
+ if arg_config("--help")
243
+ Sqlite3::ExtConf.print_help
244
+ exit!(0)
245
+ end
246
+
154
247
  if arg_config("--download-dependencies")
155
248
  Sqlite3::ExtConf.download
156
249
  exit!(0)
@@ -21,8 +21,11 @@
21
21
  #define SQLITE3_UTF8_STR_NEW2(_obj) \
22
22
  (rb_enc_associate_index(rb_str_new2(_obj), rb_utf8_encindex()))
23
23
 
24
-
25
- #include <sqlite3.h>
24
+ #ifdef USING_SQLCIPHER_INC_SUBDIR
25
+ # include <sqlcipher/sqlite3.h>
26
+ #else
27
+ # include <sqlite3.h>
28
+ #endif
26
29
 
27
30
  #ifndef HAVE_TYPE_SQLITE3_INT64
28
31
  typedef sqlite_int64 sqlite3_int64;
Binary file
Binary file
Binary file
Binary file
@@ -1,16 +1,14 @@
1
1
  module SQLite3
2
2
 
3
- VERSION = "1.5.0.rc1"
3
+ VERSION = "1.5.1"
4
4
 
5
5
  module VersionProxy
6
-
7
6
  MAJOR = 1
8
7
  MINOR = 5
9
- TINY = 0
10
- BUILD = "rc1"
8
+ TINY = 1
9
+ BUILD = nil
11
10
 
12
11
  STRING = [ MAJOR, MINOR, TINY, BUILD ].compact.join( "." )
13
- #:beta-tag:
14
12
 
15
13
  VERSION = ::SQLite3::VERSION
16
14
  end
@@ -534,5 +534,12 @@ module SQLite3
534
534
  end
535
535
  assert_includes error.message, "no such column: nope"
536
536
  end
537
+
538
+ def test_load_extension_with_nonstring_argument
539
+ db = SQLite3::Database.new(':memory:')
540
+ skip("extensions are not enabled") unless db.respond_to?(:load_extension)
541
+ assert_raises(TypeError) { db.load_extension(1) }
542
+ assert_raises(TypeError) { db.load_extension(Pathname.new("foo.so")) }
543
+ end
537
544
  end
538
545
  end
data/test/test_sqlite3.rb CHANGED
@@ -19,7 +19,12 @@ module SQLite3
19
19
  end
20
20
 
21
21
  def test_version_strings
22
+ skip if SQLite3::VERSION.include?("test") # see set-version-to-timestamp rake task
22
23
  assert_equal(SQLite3::VERSION, SQLite3::VersionProxy::STRING)
23
24
  end
25
+
26
+ def test_compiled_version_and_loaded_version
27
+ assert_equal(SQLite3::SQLITE_VERSION, SQLite3::SQLITE_LOADED_VERSION)
28
+ end
24
29
  end
25
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sqlite3
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0.rc1
4
+ version: 1.5.1
5
5
  platform: arm-linux
6
6
  authors:
7
7
  - Jamis Buck
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2022-07-05 00:00:00.000000000 Z
13
+ date: 2022-09-29 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: minitest
@@ -178,9 +178,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
178
178
  version: 3.2.dev
179
179
  required_rubygems_version: !ruby/object:Gem::Requirement
180
180
  requirements:
181
- - - ">"
181
+ - - ">="
182
182
  - !ruby/object:Gem::Version
183
- version: 1.3.1
183
+ version: '0'
184
184
  requirements: []
185
185
  rubygems_version: 3.3.4
186
186
  signing_key: