Skip Menu |

This queue is for tickets about the IPC-ShareLite CPAN distribution.

Report information
The Basics
Id: 17663
Status: resolved
Priority: 0/
Queue: IPC-ShareLite

People
Owner: Nobody in particular
Requestors: AJGOUGH [...] cpan.org
Cc:
AdminCc:

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



Subject: Segfault during 'make test' with FreeBSD 5.4/Perl5.8.6 with 64 bit ints
IPC::ShareLite segfaults during make test, while in the read_share xs function. This happens when zero length items are fed into sv_usepvn. This patch seems to fix it, but was knocked up quickly so should be applied with caution and further testing. diff -u IPC-ShareLite-0.09/ShareLite.xs IPC-ShareLite-0.09_fixed/ ShareLite.xs --- IPC-ShareLite-0.09/ShareLite.xs Sat Jul 15 10:59:52 2000 +++ IPC-ShareLite-0.09_fixed/ShareLite.xs Wed Feb 15 18:30:08 2006 @@ -335,12 +335,17 @@ char* data; int length; CODE: - share = (Share *)SvIV(ST(0)); length = read_share(share, &data); - ST(0) = sv_newmortal(); - if (length >= 0) { - sv_usepvn((SV*)ST(0), data, length); - } else { + if (length > 0) { + ST(0) = sv_2mortal(newSVpv(data, length)); + free(data); + } + else if (length == 0) { + ST(0) = sv_2mortal(newSVpv("", 0)); + free(data); /* XXX? */ + } + else { + ST(0) = sv_newmortal(); sv_setsv(ST(0), &PL_sv_undef); } diff -u IPC-ShareLite-0.09/typemap IPC-ShareLite-0.09_fixed/typemap --- IPC-ShareLite-0.09/typemap Fri Apr 14 10:23:54 2000 +++ IPC-ShareLite-0.09_fixed/typemap Wed Feb 15 17:29:22 2006 @@ -1,14 +1,11 @@ TYPEMAP -Share* SHARE +Share* T_PTROBJ key_t KEY INPUT -SHARE - $var = (Share *)SvIV($arg); KEY $var = (key_t) SvIV($arg); OUTPUT -SHARE - sv_setiv($arg, (I32) $var); +
From: david.pitt [...] nab.com.au
On Wed Feb 15 15:28:55 2006, AJGOUGH wrote: Show quoted text
> IPC::ShareLite segfaults during make test, while in the read_share
xs Show quoted text
> function. This happens when zero length items are fed into
sv_usepvn. Show quoted text
> This patch seems to fix it, but was knocked up quickly so should be > applied with caution and further testing. > > diff -u IPC-ShareLite-0.09/ShareLite.xs IPC-ShareLite-0.09_fixed/ > ShareLite.xs > --- IPC-ShareLite-0.09/ShareLite.xs Sat Jul 15 10:59:52 2000 > +++ IPC-ShareLite-0.09_fixed/ShareLite.xs Wed Feb 15 18:30:08
2006 Show quoted text
> @@ -335,12 +335,17 @@ > char* data; > int length; > CODE: > - share = (Share *)SvIV(ST(0)); > length = read_share(share, &data); > - ST(0) = sv_newmortal(); > - if (length >= 0) { > - sv_usepvn((SV*)ST(0), data, length); > - } else { > + if (length > 0) { > + ST(0) = sv_2mortal(newSVpv(data, length)); > + free(data); > + } > + else if (length == 0) { > + ST(0) = sv_2mortal(newSVpv("", 0)); > + free(data); /* XXX? */ > + } > + else { > + ST(0) = sv_newmortal(); > sv_setsv(ST(0), &PL_sv_undef); > } > > diff -u IPC-ShareLite-0.09/typemap IPC-ShareLite-0.09_fixed/typemap > --- IPC-ShareLite-0.09/typemap Fri Apr 14 10:23:54 2000 > +++ IPC-ShareLite-0.09_fixed/typemap Wed Feb 15 17:29:22 2006 > @@ -1,14 +1,11 @@ > TYPEMAP > -Share* SHARE > +Share* T_PTROBJ > key_t KEY > > INPUT > -SHARE > - $var = (Share *)SvIV($arg); > KEY > $var = (key_t) SvIV($arg); > > OUTPUT > -SHARE > - sv_setiv($arg, (I32) $var); > +
Encountered same (or similar) problem on Solaris 8 (SunOS 5.8) with 64- bit Perl 5.8.7.
This is fixed in 0.10. Thanks for the report.