summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2025-02-09 10:02:10 -0500
committerRich Felker <dalias@aerifal.cx>2025-02-09 10:02:10 -0500
commit5e594aeabf331ae0abb380c5fa58e5348b2b0148 (patch)
tree7a27a8ed715fc935437bca1bee17a126f3c2df2c /src
parent6af4f25b899e89e4b91f8c197ae5a6ce04bcce7b (diff)
downloadmusl-5e594aeabf331ae0abb380c5fa58e5348b2b0148.tar.gz
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.
Diffstat (limited to 'src')
-rw-r--r--src/locale/iconv.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/locale/iconv.c b/src/locale/iconv.c
index 7fb2e1ef..9605c8e9 100644
--- a/src/locale/iconv.c
+++ b/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];