mirror of
git://git.musl-libc.org/musl
synced 2025-03-06 20:48:29 +01:00
iconv: fix missing bounds checking for shift_jis decoding
the jis0208 table we use is only 84x94 in size, but the shift_jis encoding supports a 94x94 grid. attempts to convert sequences outside of the supported zone resulted in out-of-bounds table reads, misinterpreting adjacent rodata as part of the character table and thereby converting these sequences to unexpected characters.
This commit is contained in:
parent
fd7d018521
commit
7ada6dde6f
1 changed files with 1 additions and 0 deletions
|
@ -340,6 +340,7 @@ size_t iconv(iconv_t cd, char **restrict in, size_t *restrict inb, char **restri
|
|||
c++;
|
||||
d -= 159;
|
||||
}
|
||||
if (c>=84) goto ilseq;
|
||||
c = jis0208[c][d];
|
||||
if (!c) goto ilseq;
|
||||
break;
|
||||
|
|
Loading…
Add table
Reference in a new issue