[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bug#13530: head: memory exhausted when printing all from stdin but l
From: |
Jim Meyering |
Subject: |
Re: bug#13530: head: memory exhausted when printing all from stdin but last P/E bytes |
Date: |
Sun, 26 May 2013 19:07:34 +0200 |
Pádraig Brady wrote:
...
> I expect to push soon, the attached more complete fix to realloc the array.
That new test would still fail on 32-bit systems, and on any system
with SIZE_MAX < 1E. I expect to push the additional fix below.
As for testing, I can't think of anything better than to suggest
testing in a 32-bit virtual machine.
>From 8c647adfcd7d9ae66f7759f1bbf9ac3f78c23503 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sun, 26 May 2013 09:49:22 -0700
Subject: [PATCH] head: with --bytes=-N don't fail early for large N on 32-bit
systems
* src/head.c (elide_tail_bytes_pipe): The new test would fail
unnecessarily on 32-bit systems, where SIZE_MAX < 1E.
---
src/head.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/src/head.c b/src/head.c
index 00e1be1..6b7758f 100644
--- a/src/head.c
+++ b/src/head.c
@@ -221,13 +221,6 @@ elide_tail_bytes_pipe (const char *filename, int fd,
uintmax_t n_elide_0)
"HEAD_TAIL_PIPE_BYTECOUNT_THRESHOLD must be at least 2 * READ_BUFSIZE"
#endif
- if (SIZE_MAX < n_elide_0 + READ_BUFSIZE)
- {
- char umax_buf[INT_BUFSIZE_BOUND (n_elide_0)];
- error (EXIT_FAILURE, 0, _("%s: number of bytes is too large"),
- umaxtostr (n_elide_0, umax_buf));
- }
-
/* Two cases to consider...
1) n_elide is small enough that we can afford to double-buffer:
allocate 2 * (READ_BUFSIZE + n_elide) bytes
--
1.8.3
- Re: bug#13530: head: memory exhausted when printing all from stdin but last P/E bytes,
Jim Meyering <=
- Re: bug#13530: head: memory exhausted when printing all from stdin but last P/E bytes, Pádraig Brady, 2013/05/26
- Re: bug#13530: head: memory exhausted when printing all from stdin but last P/E bytes, Jim Meyering, 2013/05/26
- Re: bug#13530: head: memory exhausted when printing all from stdin but last P/E bytes, Jim Meyering, 2013/05/26
- Re: bug#13530: head: memory exhausted when printing all from stdin but last P/E bytes, Pádraig Brady, 2013/05/26
- Re: bug#13530: head: memory exhausted when printing all from stdin but last P/E bytes, Jim Meyering, 2013/05/26
- Re: bug#13530: head: memory exhausted when printing all from stdin but last P/E bytes, Jim Meyering, 2013/05/26
- Re: bug#13530: head: memory exhausted when printing all from stdin but last P/E bytes, Pádraig Brady, 2013/05/26
- Re: bug#13530: head: memory exhausted when printing all from stdin but last P/E bytes, Jim Meyering, 2013/05/27
- Re: bug#13530: head: memory exhausted when printing all from stdin but last P/E bytes, Paul Eggert, 2013/05/27
- Re: bug#13530: head: memory exhausted when printing all from stdin but last P/E bytes, Jim Meyering, 2013/05/27