Author: timbo
Date: Thu Apr 26 03:26:47 2007
New Revision: 9454

Modified:
   dbi/trunk/Changes
   dbi/trunk/Driver.xst
   dbi/trunk/Driver_xst.h

Log:
Fixed potential corruption in selectall_arrayref and selectrow_arrayref for 
compiled drivers, thanks to Rob Davies.


Modified: dbi/trunk/Changes
==============================================================================
--- dbi/trunk/Changes   (original)
+++ dbi/trunk/Changes   Thu Apr 26 03:26:47 2007
@@ -6,6 +6,8 @@
 
 =cut
 
+Assorted TODO notes:
+
 Policy principle:
     Designed to influence behaviour of unaltered programs
     ie go_* attributes take precidence over policy
@@ -42,6 +44,9 @@
   Fixed set_err() so HandleSetErr hook is executed reliably, if set.
   Fixed accuracy of profiling when perl configured to use long doubles.
   Fixed 42prof_data.t on fast systems with poor timers thanks to Malcolm 
Nooning.
+  Fixed potential corruption in selectall_arrayref and selectrow_arrayref
+    for compiled drivers, thanks to Rob Davies.
+    Rebuild your compiled drivers after installing DBI.
 
   Changed some handle creation code from perl to C code,
     to reduce handle creation cost by ~20%.

Modified: dbi/trunk/Driver.xst
==============================================================================
--- dbi/trunk/Driver.xst        (original)
+++ dbi/trunk/Driver.xst        Thu Apr 26 03:26:47 2007
@@ -111,7 +111,7 @@
                (DBD_ATTRIB_TRUE(attr,"Slice",5,tmp_svp) || 
DBD_ATTRIB_TRUE(attr,"Columns",7,tmp_svp))
        ) {
            /* fallback to perl implementation */
-           ST(0) = 
dbixst_bounce_method("DBD::~DRIVER~::db::SUPER::selectall_arrayref", items);
+           ST(0) 
=dbixst_bounce_method("DBD::~DRIVER~::db::SUPER::selectall_arrayref", items);
            XSRETURN(1);
        }
     }
@@ -121,6 +121,7 @@
     }
     else {
        sth = dbixst_bounce_method("prepare", 3);
+        SPAGAIN; SP -= items; /* because stack might have been realloc'd */
        if (!SvROK(sth))
            XSRETURN_UNDEF;
     }
@@ -157,6 +158,7 @@
     else {
        /* --- prepare --- */
        sth = dbixst_bounce_method("prepare", 3);
+        SPAGAIN; SP -= items; /* because stack might have been realloc'd */
        if (!SvROK(sth)) {
            if (is_selectrow_array) { XSRETURN_EMPTY; } else { XSRETURN_UNDEF; }
        }

Modified: dbi/trunk/Driver_xst.h
==============================================================================
--- dbi/trunk/Driver_xst.h      (original)
+++ dbi/trunk/Driver_xst.h      Thu Apr 26 03:26:47 2007
@@ -6,6 +6,12 @@
 #  License or the Artistic License, as specified in the Perl README file.
 */
 
+
+/* This is really just a workaround for SUPER:: not working right for XS code.
+ * It would be better if we setup perl's context so SUPER:: did the right thing
+ * (borrowing the relevant magic from pp_entersub in perl pp_hot.c).
+ * Then we could just use call_method("SUPER::foo") instead.
+ */
 static SV *
 dbixst_bounce_method(char *methname, int params)
 {

Reply via email to