On Mon, 15 Apr 2002, Dan Sugalski wrote:
> At 10:26 PM +0200 4/15/02, Peter Gibbs wrote: > > > >Note that string_grow still has the problem with not bothering to allocate a > >new buffer if copysize is zero, e.g. if we are expanding a previously empty > >buffer. > > > >I have submitted a patch for this previously, but since string_grow has now > >changed, herewith a resynced patch. > > This has been applied too. There's something bugging me about it--I > think there may be issues, and I'd really like it if we made sure we > had a bunch of zero-length string tests in the test suite. Well, one issue with this patch is that Parrot will now segfault if (s>buflen + addlen) < 0. It doesn't seem possible to actually provoke this behaviour at the moment, however - string_grow is only called from one place in string_replace, and the code in string_replace ensures that addlen > 0. It's easy enough to add a test in string_grow to avoid the problem, but I'm not sure what we should return in that case: the input string s, or a newly created empty string? Simon