Skip to content

Commit deb56f9

Browse files
committed
Fix Ruby 2.7 rb_check_safe_obj warnings
1 parent 0894fba commit deb56f9

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

ext/sqlite3/database.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,13 @@ static VALUE rb_sqlite3_open_v2(VALUE self, VALUE file, VALUE mode, VALUE zvfs)
4040

4141
Data_Get_Struct(self, sqlite3Ruby, ctx);
4242

43+
#if defined TAINTING_SUPPORT
4344
#if defined StringValueCStr
4445
StringValuePtr(file);
4546
rb_check_safe_obj(file);
4647
#else
4748
Check_SafeStr(file);
49+
#endif
4850
#endif
4951

5052
status = sqlite3_open_v2(
@@ -761,11 +763,13 @@ static VALUE rb_sqlite3_open16(VALUE self, VALUE file)
761763

762764
Data_Get_Struct(self, sqlite3Ruby, ctx);
763765

766+
#if defined TAINTING_SUPPORT
764767
#if defined StringValueCStr
765768
StringValuePtr(file);
766769
rb_check_safe_obj(file);
767770
#else
768771
Check_SafeStr(file);
772+
#endif
769773
#endif
770774

771775
status = sqlite3_open16(utf16_string_value_ptr(file), &ctx->db);

ext/sqlite3/extconf.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@
4747
$CFLAGS << ' -W3'
4848
end
4949

50+
if RUBY_VERSION < '2.7'
51+
$CFLAGS << ' -DTAINTING_SUPPORT'
52+
end
53+
5054
def asplode missing
5155
if RUBY_PLATFORM =~ /mingw|mswin/
5256
abort "#{missing} is missing. Install SQLite3 from " +

0 commit comments

Comments
 (0)