[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Bug in svn_stringbuf_insert and svn_stringbuf_replace

From: Stefan Fuhrmann <stefan.fuhrmann_at_wandisco.com>
Date: Fri, 9 Jan 2015 19:00:25 +0100

On Fri, Jan 9, 2015 at 6:52 PM, Julian Foad <julianfoad_at_btopenworld.com>
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() should fix it.
>
> Same in svn_stringbuf_replace().
>

Yes, you are right. I'll fix this.

> Inadequate test coverage. It is tested only with non-zero-length strings
> of ASCII characters. (Another scenario not tested is inserting a string
> that overlaps the existing string and starts or ends at the existing
> string's start or end or end-plus-null.)
>

I'll add test code for these as well.

-- Stefan^2.
Received on 2015-01-09 19:01:40 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.