diff --git a/NEWS b/NEWS index d4345477a..6b4d6855e 100644 --- a/NEWS +++ b/NEWS @@ -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. diff --git a/src/pr.c b/src/pr.c index 29321e58e..e0140e567 100644 --- a/src/pr.c +++ b/src/pr.c @@ -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;