Patch for DBI dataloss problem



Hello

As reported in the Debian bug tracking system. Can you comment if this
patch is OK?

bye,

-christian-



From: Tim Cutts <tjrc@xxxxxxxxxxxx>
To: ch@xxxxxxxxxx
Subject: libdbi-perl 1.55
Date: Mon, 14 May 2007 11:48:26 +0100
X-Mailer: Apple Mail (2.752.2)

Hi Christian,

One of the changes introduced in DBI 1.55 is a very small fix which
fixes a bug which can really cause data loss (a problem with
selectall_arrayref). The bug was spotted by one of my colleagues
here (Rob Davies, whom Tim Bunce credits in the changelog). We have
actually seen it cause real data loss here, so it's not just a
theoretical problem.

What I was wondering was whether there is any way we can get that fix
into Debian on etch's next point release? The patch to fix that
particular issue is as follows:

diff -Naur DBI-1.54/DBI.xs DBI-1.54.patched/DBI.xs
--- DBI-1.54/DBI.xs 2007-02-22 01:36:15.000000000 +0000
+++ DBI-1.54.patched/DBI.xs 2007-04-26 09:38:00.667000000 +0100
@@ -9,7 +9,7 @@

#define IN_DBI_XS 1 /* see DBIXS.h */
#define PERL_NO_GET_CONTEXT
-
+#include <assert.h>
#include "DBIXS.h" /* DBI public interface for DBD's written in C
*/

# if (defined(_WIN32) && (! defined(HAS_GETTIMEOFDAY)))
@@ -3104,6 +3104,9 @@
outitems = perl_call_sv(isGV(imp_msv) ? (SV*)GvCV(imp_msv) :
imp_msv,
(is_DESTROY ? gimme | G_EVAL | G_KEEPERR : gimme) );
}
+
+ assert(outitems >= 0);
+
SPAGAIN;

/* XXX restore local vars so ST(n) works below */
diff -Naur DBI-1.54/Driver.xst DBI-1.54.patched/Driver.xst
--- DBI-1.54/Driver.xst 2007-02-22 01:36:15.000000000 +0000
+++ DBI-1.54.patched/Driver.xst 2007-04-26 15:15:47.084000000 +0100
@@ -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; }
}

.



Relevant Pages

  • Re: 2.6.27-rc5-mm1
    ... See the `hot-fixes' directory for any important updates to this patchset. ... If you hit a bug in -mm and it is not obvious which patch caused it, ... ALSA fix ...
    (Linux-Kernel)
  • 2.6.27-rc1-mm1
    ... See the `hot-fixes' directory for any important updates to this patchset. ... If you hit a bug in -mm and it is not obvious which patch caused it, ... CIFS fix ...
    (Linux-Kernel)
  • Re: thoughts on kernel security issues
    ... having two independent patches that fix them is STILL better. ... Take it from me - I've been reviewing patches for _way_ too long. ... have a clue ("try reverting that one patch") or you can do things like ... Which is why lots of small patches usually have _different_ bug behaviour ...
    (Linux-Kernel)
  • 2.6.22-rc4-mm2
    ... trees were repulled, several bad patches were dropped, a few were fixed. ... If you hit a bug in -mm and it is not obvious which patch caused it, ... wireless sparse fix ...
    (Linux-Kernel)
  • 2.6.17-rc4-mm3
    ... If you hit a bug in -mm and it is not obvious which patch caused it, ... Driver tree updates ... Fix reject in git-nfs.patch. ...
    (Linux-Kernel)