Subject: | Patch for segfault issue |
segfault found when after having retrieved all the rows from a sth, another attempt causes perl to segfault. Fixed by uncommenting existing code as shown in patch. Patch also includes testcase to replicate this problem.
perl -v
This is perl, v5.8.0 built for i386-linux-thread-multi
(with 1 registered patch, see perl -V for more detail)
uname -a
Linux localhost 2.4.20-8 #1 Thu Mar 13 17:54:28 EST 2003 i686 i686 i386 GNU/Linux
diff -ru DBD-SQLite-0.31/dbdimp.c new/dbdimp.c
--- DBD-SQLite-0.31/dbdimp.c 2004-02-15 04:36:38.000000000 +1100
+++ new/dbdimp.c 2004-04-16 10:09:59.000000000 +1000
@@ -455,11 +455,9 @@
/* warn("current_entry == %d\nnumFields == %d\nnrow == %d",
current_entry, numFields, imp_sth->nrow); */
- /*
if (!DBIc_ACTIVE(imp_sth)) {
return Nullav;
}
- */
if ((imp_sth->retval == SQLITE_DONE) || (imp_sth->retval == SQLITE_ERROR)) {
sqlite_st_finish(sth, imp_sth);
diff -ru DBD-SQLite-0.31/t/30insertfetch.t new/t/30insertfetch.t
--- DBD-SQLite-0.31/t/30insertfetch.t 2002-02-20 04:19:57.000000000 +1100
+++ new/t/30insertfetch.t 2004-04-16 10:20:53.000000000 +1000
@@ -125,6 +125,11 @@
$cursor->errstr eq '')), 'fetch select deleted')
or DbiError($cursor->err, $cursor->errstr);
+ Test($state or (!defined($row = $cursor->fetchrow_arrayref) &&
+ (!defined($errstr = $cursor->errstr) ||
+ $cursor->errstr eq '')), 'fetch on empty statement handler')
+ or DbiError($cursor->err, $cursor->errstr);
+
Test($state or $cursor->finish, 'finish select deleted')
or DbiError($cursor->err, $cursor->errstr);