locale.c: get_displayable_string: Check bad input

Just refuse to go out of bounds on an empty string
This commit is contained in:
Karl Williamson 2023-03-27 17:38:17 -06:00
parent 2d34d1ba74
commit e945ef1bb8

View File

@ -6478,6 +6478,10 @@ S_get_displayable_string(pTHX_
bool first_time = TRUE;
char * ret;
if (e <= s) {
return "";
}
/* Worst case scenario: All are non-printable so have a blank between each.
* If UTF-8, all are the largest possible code point; otherwise all are a
* single byte. '(2 + 1)' is from each byte takes 2 characters to