mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-17 18:02:09 +03:00
pr: fix a crash when reading more than INT_MAX bytes for a single page
* src/pr.c (buff_current): Define as an idx_t instead of an int. (line_vector): Define as an array of idx_t elements instead of int. (store_colum): Define a variable used to set buff_current as an idx_t. * NEWS: Mention the bug fix. Discovered by Anthropic's OSS Scanner, as bug ANT-2026-C1YW9FO0.
This commit is contained in:
1 parent
56531e52a3
commit
d58314f178
2 files changed
+7
-3
No files matched your search
@@ -96,6 +96,10 @@ GNU coreutils NEWS -*- outline -*-
|
||||
od now exits gracefully when offsets overflow integer limits.
|
||||
[This bug was present in "the beginning".]
|
||||
|
||||
'pr' no longer reads past its internal buffer and crashes when it reads more
|
||||
than INT_MAX bytes of column data for a single page.
|
||||
[This bug was present in "the beginning".]
|
||||
|
||||
'realpath' without -s, or 'readlink' with -e,-f,-m no longer
|
||||
loop infinitely when resolving a symbolic link which
|
||||
resolves to a path beginning with the symbolic link itself.
|
||||
|
||||
@@ -456,7 +456,7 @@ static char *buff;
|
||||
|
||||
/* Index of the position in buff where the next character
|
||||
will be stored. */
|
||||
static unsigned int buff_current;
|
||||
static idx_t buff_current;
|
||||
|
||||
/* The number of characters in buff.
|
||||
Used for allocation of buff and to detect overflow of buff. */
|
||||
@@ -466,7 +466,7 @@ static idx_t buff_allocated;
|
||||
Each entry is an index of the first character of a line.
|
||||
This is used when storing lines to facilitate shuffling when
|
||||
we do column balancing on the last page. */
|
||||
static int *line_vector;
|
||||
static idx_t *line_vector;
|
||||
|
||||
/* Array of horizontal positions.
|
||||
For each line in line_vector, end_vector[line] is the horizontal
|
||||
@@ -1955,7 +1955,7 @@ store_columns (void)
|
||||
{
|
||||
int i, j;
|
||||
unsigned int line = 0;
|
||||
unsigned int buff_start;
|
||||
idx_t buff_start;
|
||||
int last_col; /* The rightmost column which will be saved in buff */
|
||||
COLUMN *p;
|
||||
|
||||
|
||||
Reference in new issue
Block a user