Browse Source

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.
master
Rich Felker 2 years ago
parent
commit
5e594aeabf
  1. 2
      src/locale/iconv.c

2
src/locale/iconv.c

@ -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];

Loading…
Cancel
Save