1
0
Fork 0
mirror of git://git.musl-libc.org/musl synced 2025-03-06 20:48:29 +01:00

iconv: fix erroneous decoding of some invalid ShiftJIS sequences

out-of-range second bytes were not handled, leading to wrong character
output rather than a reported encoding error.

fix based on bug report by Nick Wellnhofer, submitted in private in
case the issue turned out to have security implications.
This commit is contained in:
Rich Felker 2025-02-09 10:02:10 -05:00
parent 6af4f25b89
commit 5e594aeabf

View file

@ -339,6 +339,8 @@ size_t iconv(iconv_t cd, char **restrict in, size_t *restrict inb, char **restri
} else if (d-159 <= 252-159) {
c++;
d -= 159;
} else {
goto ilseq;
}
if (c>=84) goto ilseq;
c = jis0208[c][d];