[reportlab-users] pyRXP - strange non-deterministic errors on python 2.7 and 64-bit Linux

Robin Becker robin at reportlab.com
Wed May 18 15:25:40 EDT 2011


On 18 May 2011 18:30, Tim Roberts <timr at probo.com> wrote:


> Robin Becker wrote:

> > OK this is the errant code in url.c

> >

> > p=merged_path

> >

> > .....

> >

> > fprintf(stderr," 261: merged_path=%s i=%d j=%d p[i+1]=%c\n",

> > merged_path,i,j,p[i+1]);

> > /* Do we have "." ? */

> >

> > if(j - i == 2 && p[i+1] == '.')

> > {fprintf(stderr," 265: p+i+1=%s p+j=%s

> > (&p[i+1]-&p[0])=%d\n", p+i+1,p+j,&p[i+1]-&p[0]);

> > strcpy(&p[i+1], p[j] ? &p[j+1] : &p[j]);

> > ...

> > so the error appears to be in strcpy; not sure if that's rxp's fault or

> not any

> > ideas?

>

> A ha! NOW it makes sense!

>

> The results of strcpy are undefined when the source and destination

> overlap, as is the case here. The 32-bit implementation did what you

> expected, although it was not required to. The 64-bit implementation

> apparently contains optimizations that break this case. It is allowed

> to do that.

>

> The code needs to compute the length of the copy and use memmove instead

> of strcpy, or do the copying in a loop.

>

>


yes I just read the manpage and it's the overlap that's the problem. I think
rxp comes from an era when 64 bits was just a dream (or nightmare). I will
have to work out some suitable fix and then look for similar cases. Then
push the patch upstream. On the other hand it may be that upstream rxp has
already fixed this in which case I'll have to do a proper merge.



> --

> Tim Roberts, timr at probo.com

> Providenza & Boekelheide, Inc.

>

> _______________________________________________

> reportlab-users mailing list

> reportlab-users at lists2.reportlab.com

> http://two.pairlist.net/mailman/listinfo/reportlab-users

>




--
--
Robin Becker
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20110518/5b5aec24/attachment.html>


More information about the reportlab-users mailing list