Re: Bug in svn_stringbuf_insert and svn_stringbuf_replace

2015-01-13 Thread Stefan Fuhrmann
On Fri, Jan 9, 2015 at 7:26 PM, Julian Foad wrote: > Stefan Fuhrmann wrote: > [...] > > Yes, you are right. I'll fix this. > [...] > > I'll add test code for these as well. > > Thanks. > Done in r1650834. After that you might want to eliminate the recursion, trivially, in both > functions: > >

Re: Bug in svn_stringbuf_insert and svn_stringbuf_replace

2015-01-09 Thread Julian Foad
Stefan Fuhrmann wrote: [...] > Yes, you are right. I'll fix this. [...] > I'll add test code for these as well. Thanks. After that you might want to eliminate the recursion, trivially, in both functions:   if //it overlaps     {   bytes = apr_pmemdup(str->pool, bytes, count);   // don't

Re: Bug in svn_stringbuf_insert and svn_stringbuf_replace

2015-01-09 Thread Stefan Fuhrmann
On Fri, Jan 9, 2015 at 6:52 PM, Julian Foad wrote: > I just spotted this. > > svn_stringbuf_insert() contains this: > > temp = apr_pstrndup(str->pool, bytes, count); > > > That's wrong for an arbitrary array of bytes, because it will stop copying > at the first null byte. > > Using apr_pmemdup(

Bug in svn_stringbuf_insert and svn_stringbuf_replace

2015-01-09 Thread Julian Foad
I just spotted this. svn_stringbuf_insert() contains this:   temp = apr_pstrndup(str->pool, bytes, count); That's wrong for an arbitrary array of bytes, because it will stop copying at the first null byte. Using apr_pmemdup() should fix it. Same in svn_stringbuf_replace(). Inadequate test c