mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-25 14:20:46 +03:00
display: report and catch a bad state, to prevent a possible hang
This commit is contained in:
parent
bf6bcde078
commit
c0e3779453
@ -1888,6 +1888,13 @@ char *display_string(const char *buf, size_t column, size_t span,
|
||||
/* Allocate enough space for converting the relevant part of the line. */
|
||||
converted = charalloc(strlen(buf) * (MAXCHARLEN + tabsize) + 1);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (span > HIGHEST_POSITIVE) {
|
||||
statusline(ALERT, "Span has underflowed -- please report a bug");
|
||||
converted[0] = '\0';
|
||||
return converted;
|
||||
}
|
||||
#endif
|
||||
/* If the first character starts before the left edge, or would be
|
||||
* overwritten by a "<" token, then show placeholders instead. */
|
||||
if (*buf != '\0' && *buf != '\t' && (start_col < column ||
|
||||
|
Loading…
Reference in New Issue
Block a user