diff --git a/Remove-deprecated-taint-followup.patch b/Remove-deprecated-taint-followup.patch new file mode 100644 index 0000000000000000000000000000000000000000..9ed8c3d503812efcb46dfb7fc5e44ec61fa33097 --- /dev/null +++ b/Remove-deprecated-taint-followup.patch @@ -0,0 +1,108 @@ +diff -Nur a/ext/sqlite3/database.c b/ext/sqlite3/database.c +--- a/ext/sqlite3/database.c 2022-01-27 14:30:56.122375149 +0800 ++++ b/ext/sqlite3/database.c 2022-01-27 14:30:45.214194939 +0800 +@@ -57,7 +57,9 @@ + rb_scan_args(argc, argv, "12", &file, &opts, &zvfs); + #if defined StringValueCStr + StringValuePtr(file); ++#if defined TAINTING_SUPPORT + rb_check_safe_obj(file); ++#endif + #else + Check_SafeStr(file); + #endif +@@ -307,7 +309,7 @@ + return rb_float_new(sqlite3_value_double(val)); + break; + case SQLITE_TEXT: +- return rb_tainted_str_new2((const char *)sqlite3_value_text(val)); ++ return rb_str_new2((const char *)sqlite3_value_text(val)); + break; + case SQLITE_BLOB: { + /* Sqlite warns calling sqlite3_value_bytes may invalidate pointer from sqlite3_value_blob, +@@ -317,7 +319,7 @@ + */ + int len = sqlite3_value_bytes(val); + #ifdef HAVE_RUBY_ENCODING_H +- return rb_tainted_str_new((const char *)sqlite3_value_blob(val), len); ++ return rb_str_new((const char *)sqlite3_value_blob(val), len); + #else + /* When encoding is not available, make it class SQLite3::Blob. */ + VALUE strargv[1]; +diff -Nur a/ext/sqlite3/extconf.rb b/ext/sqlite3/extconf.rb +--- a/ext/sqlite3/extconf.rb 2022-01-27 14:30:56.122375149 +0800 ++++ b/ext/sqlite3/extconf.rb 2022-01-27 14:29:34.125020499 +0800 +@@ -33,6 +33,10 @@ + $CFLAGS << ' -W3' + end + ++if RUBY_VERSION < '2.7' ++ $CFLAGS << ' -DTAINTING_SUPPORT' ++end ++ + def asplode missing + if RUBY_PLATFORM =~ /mingw|mswin/ + abort "#{missing} is missing. Install SQLite3 from " + +diff -Nur a/ext/sqlite3/statement.c b/ext/sqlite3/statement.c +--- a/ext/sqlite3/statement.c 2022-01-27 14:30:56.126375215 +0800 ++++ b/ext/sqlite3/statement.c 2022-01-27 14:29:34.125020499 +0800 +@@ -148,7 +148,7 @@ + break; + case SQLITE_TEXT: + { +- VALUE str = rb_tainted_str_new( ++ VALUE str = rb_str_new( + (const char *)sqlite3_column_text(stmt, i), + (long)sqlite3_column_bytes(stmt, i) + ); +@@ -162,7 +162,7 @@ + break; + case SQLITE_BLOB: + { +- VALUE str = rb_tainted_str_new( ++ VALUE str = rb_str_new( + (const char *)sqlite3_column_blob(stmt, i), + (long)sqlite3_column_bytes(stmt, i) + ); +diff -Nur a/test/test_integration_resultset.rb b/test/test_integration_resultset.rb +--- a/test/test_integration_resultset.rb 2022-01-27 14:30:56.134375348 +0800 ++++ b/test/test_integration_resultset.rb 2022-01-27 14:29:34.125020499 +0800 +@@ -105,23 +105,6 @@ + assert_equal hash[1], "foo" + end + +- def test_tainted_results_as_hash +- @db.results_as_hash = true +- @result.reset( 1 ) +- row = @result.next +- row.each do |_, v| +- assert(v.tainted?) if String === v +- end +- end +- +- def test_tainted_row_values +- @result.reset( 1 ) +- row = @result.next +- row.each do |v| +- assert(v.tainted?) if String === v +- end +- end +- + def test_each + called = 0 + @result.reset( 1, 2 ) +diff -Nur a/test/test_statement.rb b/test/test_statement.rb +--- a/test/test_statement.rb 2022-01-27 14:30:56.138375414 +0800 ++++ b/test/test_statement.rb 2022-01-27 14:29:34.125020499 +0800 +@@ -190,11 +190,6 @@ + assert_equal ['foo'], r + end + +- def test_tainted +- r = @stmt.step +- assert r.first.tainted? +- end +- + def test_step_twice + assert_not_nil @stmt.step + assert !@stmt.done? diff --git a/rubygem-sqlite3.spec b/rubygem-sqlite3.spec index 020d16cdd6e037f88c82c985246af6376d5aef5f..b4f3dfda1f580543dc5332e5b234d82c20243759 100644 --- a/rubygem-sqlite3.spec +++ b/rubygem-sqlite3.spec @@ -1,11 +1,12 @@ %global gem_name sqlite3 Name: rubygem-%{gem_name} Version: 1.3.13 -Release: 1 +Release: 2 Summary: Allows Ruby scripts to interface with a SQLite3 database License: BSD URL: https://github.com/sparklemotion/sqlite3-ruby Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem +Patch0: Remove-deprecated-taint-followup.patch BuildRequires: ruby(release) rubygems-devel ruby-devel sqlite-devel rubygem(minitest) >= 5.0.0 BuildRequires: gcc %description @@ -23,6 +24,7 @@ Documentation for %{name}. %prep gem unpack %{SOURCE0} %setup -q -D -T -n %{gem_name}-%{version} +%patch0 -p1 gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec %build @@ -65,5 +67,8 @@ popd %{gem_instdir}/test %changelog +* Thu Jan 27 2022 liyanan - 1.3.13-2 +- Remove deprecated taint followup + * Fri Jul 24 2020 zhanghua - 1.3.13-1 - package init