On 10/11/10 13:25, Jim Meyering wrote:
> Here's a patch.
>
> The included test is a little unusual.
> Unlike most such tests, this one does not fail without the fix.
> However, running it against a valgrind-wrapped does expose the bug.
>
> Any suggestions for a better way (even O/S- or kernel-specific)
> to test this would be most welcome. While I'm inclined not
> to run valgrind directly (I run it periodically on everything,
> via wrappers), this is one possibility:
>
> seq 1000 | valgrind --error-exitcode=1 -- csplit - '/./' '{*}' || fail=1
>
> But that would involve first ensuring that it's installed and usable.
On a related note, valgrind misses overwritten buffers on the stack.
I wonder would there be a way to coerce the compiler into
mallocing such buffers and auto freeing them upon leaving scope?
cheers,
Pádraig.