Skip to content

Commit

Permalink
Fix Ruby 2.7 rb_check_safe_obj warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
byroot committed Dec 18, 2019
1 parent 0894fba commit deb56f9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ext/sqlite3/database.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@ static VALUE rb_sqlite3_open_v2(VALUE self, VALUE file, VALUE mode, VALUE zvfs)

Data_Get_Struct(self, sqlite3Ruby, ctx);

#if defined TAINTING_SUPPORT
#if defined StringValueCStr
StringValuePtr(file);
rb_check_safe_obj(file);
#else
Check_SafeStr(file);
#endif
#endif

status = sqlite3_open_v2(
Expand Down Expand Up @@ -761,11 +763,13 @@ static VALUE rb_sqlite3_open16(VALUE self, VALUE file)

Data_Get_Struct(self, sqlite3Ruby, ctx);

#if defined TAINTING_SUPPORT
#if defined StringValueCStr
StringValuePtr(file);
rb_check_safe_obj(file);
#else
Check_SafeStr(file);
#endif
#endif

status = sqlite3_open16(utf16_string_value_ptr(file), &ctx->db);
Expand Down
4 changes: 4 additions & 0 deletions ext/sqlite3/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,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 " +
Expand Down

0 comments on commit deb56f9

Please sign in to comment.