size_t changes for multibyte characters; fix for running debug trap in asynchronous pipeline; remove support for precomputed cache files for cross-compiling; more size_t and ssize_t changes to avoid overflow

This commit is contained in:
Chet Ramey
2024-06-28 14:16:29 -04:00
parent ad1f497a84
commit 5e28a1813c
20 changed files with 145 additions and 98 deletions
+4 -4
View File
@@ -1453,8 +1453,7 @@ rl_change_case (int count, int op)
#if defined (HANDLE_MULTIBYTE)
WCHAR_T wc, nwc;
char mb[MB_LEN_MAX+1];
int mlen;
size_t m;
size_t m, mlen;
mbstate_t mps;
#endif
@@ -1532,12 +1531,13 @@ change_singlebyte:
memset (&ts, 0, sizeof (mbstate_t));
mlen = WCRTOMB (mb, nwc, &ts);
if (mlen < 0)
if (MB_INVALIDCH (mlen))
{
nwc = wc;
memset (&ts, 0, sizeof (mbstate_t));
mlen = WCRTOMB (mb, nwc, &ts);
if (mlen < 0) /* should not happen */
if (MB_INVALIDCH (mlen)) /* should not happen */
strncpy (mb, rl_line_buffer + start, mlen = m);
}
if (mlen > 0)