summaryrefslogtreecommitdiff
path: root/src/setjmp
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2018-06-01 22:05:48 -0400
committerRich Felker <dalias@aerifal.cx>2018-06-01 22:05:48 -0400
commit029c622a89bf8cc15fd9fd56e8e88465ca6130cf (patch)
tree0237b96514b34bbc10d6e08b676e5e0245eeb5ef /src/setjmp
parent165a1e37a570422c3f3f816a734bfea0366982e5 (diff)
downloadmusl-029c622a89bf8cc15fd9fd56e8e88465ca6130cf.tar.gz
fix output size handling for multi-unicode-char big5-hkscs characters
since this iconv implementation's output is stateless, it's necessary to know before writing anything to the output buffer whether the conversion of the current input character will fit. previously we used a hard-coded table of the output size needed for each supported output encoding, but failed to update the table when adding support for conversion to jis-based encodings and again when adding separate encoding identifiers for implicit-endianness utf-16/32 and ucs-2/4 variants, resulting in out-of-bound table reads and incorrect size checks. no buffer overflow was possible, but the affected characters could be converted incorrectly, and iconv could potentially produce an incorrect return value as a result. remove the hard-coded table, and instead perform the recursive iconv conversion to a temporary buffer, measuring the output size and transferring it to the actual output buffer only if the whole converted result fits.
Diffstat (limited to 'src/setjmp')
0 files changed, 0 insertions, 0 deletions