[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#13537: split: memory exhausted when putting at most T/P/E bytes of l
From: |
Pádraig Brady |
Subject: |
bug#13537: split: memory exhausted when putting at most T/P/E bytes of lines per output file |
Date: |
Thu, 23 May 2013 11:08:26 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 |
On 04/25/2013 02:34 AM, Pádraig Brady wrote:
> On 01/23/2013 11:58 PM, Lei Zhang wrote:
>> Hi All,
>>
>> In the `split' program of coreutils 8.20, we found a bug which is similar
>> to the bug reported in bug#13530:
>>
>> Invoking `split -C T' or `split -C P' or `split -C E' will cause memory
>> exhaustion.
>>
>> However, smaller units (e.g., K, M, G) work fine; bigger units (e.g., Z, Y)
>> fail properly (by outputing "invalid number of bytes").
>>
>> A bit dig reveals that the bug is introduced at line 1412 of split.c
>> (coreutils 8.20):
>>
>> 1400: switch (split_type)
>> 1401: {
>> ...
>> 1411: case type_byteslines:
>> 1412: line_bytes_split (n_units); /* this function calls
>> xmalloc(n_bytes), which fails. */
>> 1413: break;
>> ...
>> 1434: }
>>
>> `n_units' before that statement can be very large. In the case of `split -C
>> T', it is 1099511627776.
>>
>> We think this is a bug similar to the one reported in bug#13530, so we
>> bring this issue to your attention. Thanks!
>
> I intend to push the attached soon to fix this.
Bernhard Voelker kindly reviewed this and noticed
I had an '|| fail=1' inside a subshell in the test.
Also he questioned the open coding of:
error (EXIT_FAILURE, 0, "%s", _("memory exhausted"));
It's better to use the more abstract xalloc_die()
in this case (and another in lines_rr()).
I'm pushing now with these two adjustments.
thanks,
Pádraig.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug#13537: split: memory exhausted when putting at most T/P/E bytes of lines per output file,
Pádraig Brady <=