Ver código fonte

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.
Rich Felker 1 mês atrás
pai
commit
5e594aeabf
1 arquivos alterados com 2 adições e 0 exclusões
  1. 2 0
      src/locale/iconv.c

+ 2 - 0
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];