Skip Menu |

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

Report information
The Basics
Id: 16451
Status: resolved
Priority: 0/
Queue: DBD-SQLite2

People
Owner: Nobody in particular
Requestors: ntyni [...] iki.fi
Cc:
AdminCc:

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



Subject: Segmentation fault when fetchrow() is called too many times
Hi, DBD::SQLite2 crashes with a segmentation fault when fetchrow() is called again after it has returned an empty list (ie. the query has completed). Please consider the attached testcase. It crashes with 0.33 on both Perl 5.8.4 and 5.8.7 on Debian GNU/Linux 3.1 ("sarge") and unstable ("sid"). This bug report was originally filed as Debian bug #317453, http://bugs.debian.org/317453 Cheers, -- Niko Tyni ntyni@iki.fi
#!/usr/bin/perl use strict; use warnings; use DBI; my($dbh,$q); unlink("test.db"); $dbh = DBI->connect("dbi:SQLite2:test.db"); my $create = <<EOF; create table test (id INTEGER PRIMARY KEY, col1 INTEGER, col2 INTEGER); insert into test (id, col1, col2) values (1, 1, 0); EOF for (split(/\n/, $create)) { $dbh->do($_); } $q = $dbh->prepare("SELECT * FROM test WHERE col1 = ?"); $q->execute(1); my $delayed = 0; my (@row); while (1) { if (@row = $q->fetchrow()) { print "q fetch, id=$row[0], col1=$row[1], col2=$row[2]\n"; } else { last if $delayed++; } }
From: ntyni [...] iki.fi
Show quoted text
> DBD::SQLite2 crashes with a segmentation fault when fetchrow() is > called again after it has returned an empty list (ie. the query has
completed). The attached patch seems to fix this. It simply uncomments a check for an active statement handle in sqlite2_st_fetch(). Is there a reason that the check is commented out? Cheers, -- Niko Tyni ntyni@iki.fi
Download dbd-patch
application/octet-stream 641b

Message body not shown because it is not plain text.

Fix confirmed. See https://github.com/rurban/DBD-SQLite2 for my pending release -- Reini Urban
Thanks for the patch. Fixed with 0.35 now on CPAN -- Reini Urban