diff options
author | Pádraig Brady <P@draigBrady.com> | 2016-11-24 15:56:01 +0000 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2016-11-24 16:21:59 +0000 |
commit | ca99c524e828cc1a1cfeff3cdfc5349f87143829 (patch) | |
tree | 0b674cd209096b522ec385692397c720a6e29cef /src/ptx.c | |
parent | 19157e87fd2a846a91dda5a4008b02cb6ba63593 (diff) | |
download | coreutils-ca99c524e828cc1a1cfeff3cdfc5349f87143829.tar.xz |
ptx: fix an invalid heap reference with short --width
* src/ptx.c (fix_output_parameters): Ensure line_width doesn't
go negative, which can happen when the --width is less
than the --gap-size.
* tests/misc/ptx-overrun.sh: Add a test case that triggers
with ASAN. (Note the longer filename is needed to trigger).
Fixes http://bugs.gnu.org/25011
Diffstat (limited to 'src/ptx.c')
-rw-r--r-- | src/ptx.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -1235,6 +1235,8 @@ fix_output_parameters (void) if ((auto_reference || input_reference) && !right_reference) line_width -= reference_max_width + gap_size; + if (line_width < 0) + line_width = 0; /* The output lines, minimally, will contain from left to right a left context, a gap, and a keyword followed by the right context with no |