Skip Menu |
 

This queue is for tickets about the DBD-SQLite CPAN distribution.

Report information
The Basics
Id: 96050
Status: resolved
Priority: 0/
Queue: DBD-SQLite

People
Owner: Nobody in particular
Requestors: alex [...] chmrr.net
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Segfault in disconnected sqlite_db_filename
Date: Thu, 29 May 2014 01:48:17 -0400
To: bug-DBD-SQLite [...] rt.cpan.org
From: Alex Vandiver <alex [...] chmrr.net>
Download (untitled) / with headers
text/plain 1.4k
Calling sqlite_db_filename on a disconnected database handle can cause reliable segmentation faults; replication case and backtrace below. - Alex ------------------------8<------------------------- #!/usr/bin/env perl use strict; use warnings; use DBI; my $dbh = DBI->connect("dbi:SQLite:dbname=tmpfile","",""); $dbh->disconnect; my $data = []; for (1..500) { $data = [$data]; $dbh->sqlite_db_filename; } ------------------------8<------------------------- (gdb) bt #0 0x00007ffff63eb147 in sqlite3_stricmp (zLeft=<optimized out>, zRight=<optimized out>) at sqlite3.c:21956 #1 0x00007ffff63ef878 in sqlite3DbNameToBtree (db=0xd713b8, zDbName=0x7ffff647350d "main") at sqlite3.c:123423 #2 0x00007ffff63ef939 in sqlite3_db_filename (db=<optimized out>, zDbName=<optimized out>) at sqlite3.c:123436 #3 0x00007ffff63e97e1 in sqlite_db_filename (dbh=<optimized out>) at dbdimp.c:1377 #4 0x00007ffff63de32a in XS_DBD__SQLite__db_db_filename (cv=<optimized out>) at SQLite.xs:260 #5 0x00007ffff68dfcdd in XS_DBI_dispatch (cv=0xd81140) at DBI.xs:3746 #6 0x0000000000597ceb in Perl_pp_entersub () at pp_hot.c:2795 #7 0x0000000000538817 in Perl_runops_debug () at dump.c:2428 #8 0x000000000045898a in S_run_body (oldscope=1) at perl.c:2456 #9 0x000000000045801e in perl_run (my_perl=0xa3a010) at perl.c:2372 #10 0x000000000041d0cc in main (argc=2, argv=0x7fffffffd9d8, env=0x7fffffffd9f0) at perlmain.c:114
Download (untitled) / with headers
text/plain 1.6k
Thanks for the report. Patched at master: https://github.com/DBD-SQLite/DBD-SQLite/commit/81d4d11fa152eddc847ffa34f5ecb4532147373d On Thu May 29 14:48:33 2014, alex@chmrr.net wrote: Show quoted text
> Calling sqlite_db_filename on a disconnected database handle can cause > reliable segmentation faults; replication case and backtrace below. > - Alex > > ------------------------8<------------------------- > #!/usr/bin/env perl > use strict; > use warnings; > > use DBI; > > my $dbh = DBI->connect("dbi:SQLite:dbname=tmpfile","",""); > $dbh->disconnect; > my $data = []; > for (1..500) { > $data = [$data]; > $dbh->sqlite_db_filename; > } > ------------------------8<------------------------- > > (gdb) bt > #0 0x00007ffff63eb147 in sqlite3_stricmp (zLeft=<optimized out>, > zRight=<optimized out>) > at sqlite3.c:21956 > #1 0x00007ffff63ef878 in sqlite3DbNameToBtree (db=0xd713b8, > zDbName=0x7ffff647350d "main") > at sqlite3.c:123423 > #2 0x00007ffff63ef939 in sqlite3_db_filename (db=<optimized out>, > zDbName=<optimized out>) > at sqlite3.c:123436 > #3 0x00007ffff63e97e1 in sqlite_db_filename (dbh=<optimized out>) at > dbdimp.c:1377 > #4 0x00007ffff63de32a in XS_DBD__SQLite__db_db_filename > (cv=<optimized out>) > at SQLite.xs:260 > #5 0x00007ffff68dfcdd in XS_DBI_dispatch (cv=0xd81140) at DBI.xs:3746 > #6 0x0000000000597ceb in Perl_pp_entersub () at pp_hot.c:2795 > #7 0x0000000000538817 in Perl_runops_debug () at dump.c:2428 > #8 0x000000000045898a in S_run_body (oldscope=1) at perl.c:2456 > #9 0x000000000045801e in perl_run (my_perl=0xa3a010) at perl.c:2372 > #10 0x000000000041d0cc in main (argc=2, argv=0x7fffffffd9d8, > env=0x7fffffffd9f0) > at perlmain.c:114
Subject: Re: [rt.cpan.org #96050] Segfault in disconnected sqlite_db_filename
Date: Thu, 29 May 2014 11:58:00 -0400
To: bug-DBD-SQLite [...] rt.cpan.org
From: Alex Vandiver <alex [...] chmrr.net>
Download (untitled) / with headers
text/plain 553b
On 05/29/2014 03:11 AM, Kenichi Ishigaki via RT wrote: Show quoted text
Thanks for the quick fix! I'd argue that the warning isn't quite correct, however, as it causes the ->ping method to warn on a disconnected database -- which seems like a legitimate thing to do. Calling ->ping is what was actually triggering the bug for me, but proved not as reliable for triggering segfaults as calling ->sqlite_db_filename directly. - Alex
Download (untitled) / with headers
text/plain 730b
Agreed. https://github.com/DBD-SQLite/DBD-SQLite/commit/0193c3f6ff17e150bdd59de3fa0894b899311847 On Fri May 30 00:58:15 2014, alex@chmrr.net wrote: Show quoted text
> On 05/29/2014 03:11 AM, Kenichi Ishigaki via RT wrote:
> > Thanks for the report. Patched at master: > > https://github.com/DBD-SQLite/DBD- > > SQLite/commit/81d4d11fa152eddc847ffa34f5ecb4532147373d
> > Thanks for the quick fix! I'd argue that the warning isn't quite > correct, however, as it causes the ->ping method to warn on a > disconnected database -- which seems like a legitimate thing to do. > Calling ->ping is what was actually triggering the bug for me, but > proved not as reliable for triggering segfaults as calling > ->sqlite_db_filename directly. > - Alex
Closed as 1.44 was released. Thanks.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.