We have been tracking down a DBI segfault that was causing trouble for
a customer of ours.  Does this patch relative to DBI-1.52 look right
to you?

More information and test case at:

   http://rt.cpan.org/Ticket/Display.html?id=22150

Fix segfault for multiple result sets when later sets grow more
fields.  DBI assumes the number of fields stay the same for a
statement handle.

Index: DBI.xs
--- DBI.xs.~1~  Wed Oct 18 11:40:48 2006
+++ DBI.xs      Wed Oct 18 11:40:48 2006
@@ -1370,9 +1370,9 @@
 
     if ( (av = DBIc_FIELDS_AV(imp_sth)) == Nullav)
        av = dbih_setup_fbav(imp_sth);
-
-    if (1) { /* XXX turn into option later */
-       int i = DBIc_NUM_FIELDS(imp_sth);
+    else { /* XXX turn into option later */
+       dTHX;
+       int i = av_len(av) + 1;
        /* don't let SvUTF8 flag persist from one row to the next   */
        /* (only affects drivers that use sv_setpv, but most XS do) */
        while(i--)                  /* field 1 stored at index 0    */
End of Patch.

Regards,
Gisle Aas,
ActiveState

Reply via email to