提交 b7bfb5c3 编写于 作者: B Bartosz Brachaczek 提交者: Rich Felker

fix iconv conversions for iso88592-iso885916

commit 97bd6b09 refactored the table
lookup into a function and introduced an error in index computation.
the error caused garbage to be read from the table if the given charmap
had a non-zero number of elided entries.
上级 64f85587
...@@ -153,7 +153,7 @@ static void put_32(unsigned char *s, unsigned c, int e) ...@@ -153,7 +153,7 @@ static void put_32(unsigned char *s, unsigned c, int e)
static unsigned legacy_map(const unsigned char *map, unsigned c) static unsigned legacy_map(const unsigned char *map, unsigned c)
{ {
unsigned x = c - 128 + map[-1]; unsigned x = c - 128 - map[-1];
x = legacy_chars[ map[x*5/4]>>2*x%8 | x = legacy_chars[ map[x*5/4]>>2*x%8 |
map[x*5/4+1]<<8-2*x%8 & 1023 ]; map[x*5/4+1]<<8-2*x%8 & 1023 ];
return x ? x : c; return x ? x : c;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册