Skip Menu |

This queue is for tickets about the Kx CPAN distribution.

Report information
The Basics
Id: 79562
Status: resolved
Priority: 0/
Queue: Kx

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

Bug Information
Severity: Critical
Broken in: 0.039
Fixed in: 0.041



Subject: Random strings in fetching array from Kdb
There is a bug in ./accessors-c.inc" on line 442, which reads: CS(KC, av_push(av, newSVpv((const char*)kC(x),x->n))) it should read: CS(KC, av_push(av, newSVpvn((const char*)kC(x),x->n))) the second argument to newSVpv is the length of the string pointed to by the first, but if this is 0 it means the length should be auto determined by looking for the null terminator. This does not work well and we found random strings in our results. The newSVpvn function does take the second argument always as length, so 0 results in a correctly empty string. There are a few other newSVpv uses with computed length, I'll check if they are troublesome as well.
I've fixed this in https://metacpan.org/release/SLOYD/Kx-0.040_002 On Tue Sep 11 05:23:42 2012, MERIJNB wrote: Show quoted text
> There is a bug in ./accessors-c.inc" on line 442, which reads: > > CS(KC, av_push(av, newSVpv((const char*)kC(x),x->n))) > > it should read: > > CS(KC, av_push(av, newSVpvn((const char*)kC(x),x->n))) > > the second argument to newSVpv is the length of the string pointed to by > the first, but if this is 0 it means the length should be auto > determined by looking for the null terminator. This does not work well > and we found random strings in our results. The newSVpvn function does > take the second argument always as length, so 0 results in a correctly > empty string. > > There are a few other newSVpv uses with computed length, I'll check if > they are troublesome as well.
Subject: Re: [rt.cpan.org #79562] Random strings in fetching array from Kdb
Date: Sun, 21 Aug 2016 16:39:21 +1000
To: bug-Kx [...] rt.cpan.org
From: Mark Pfeiffer <markpf [...] gmail.com>
Cool. Tks :) On 21 August 2016 at 16:00, Stephan Loyd via RT <bug-Kx@rt.cpan.org> wrote: Show quoted text
> Queue: Kx > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=79562 > > > I've fixed this in https://metacpan.org/release/SLOYD/Kx-0.040_002 > > > On Tue Sep 11 05:23:42 2012, MERIJNB wrote:
> > There is a bug in ./accessors-c.inc" on line 442, which reads: > > > > CS(KC, av_push(av, newSVpv((const char*)kC(x),x->n))) > > > > it should read: > > > > CS(KC, av_push(av, newSVpvn((const char*)kC(x),x->n))) > > > > the second argument to newSVpv is the length of the string pointed to by > > the first, but if this is 0 it means the length should be auto > > determined by looking for the null terminator. This does not work well > > and we found random strings in our results. The newSVpvn function does > > take the second argument always as length, so 0 results in a correctly > > empty string. > > > > There are a few other newSVpv uses with computed length, I'll check if > > they are troublesome as well.
> > > >
-- cheers markpf@gmail.com