[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [coreutils] [PATCH] csplit: avoid buffer overrun when writing more t
From: |
Pádraig Brady |
Subject: |
Re: [coreutils] [PATCH] csplit: avoid buffer overrun when writing more than 999 files |
Date: |
Wed, 10 Nov 2010 13:49:52 +0000 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3 |
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.