about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorBartosz Brachaczek <b.brachaczek@gmail.com>2017-06-15 23:30:48 +0200
committerRich Felker <dalias@aerifal.cx>2017-06-20 20:41:23 -0400
commitb7bfb5c3a8330002250f304cb5deb522fa054eae (patch)
treeb22815f7d5db219a990c97e058286014dce69abf /src
parent64f855874c32e192382df69f4765a7e32057a005 (diff)
downloadmusl-b7bfb5c3a8330002250f304cb5deb522fa054eae.tar.gz
musl-b7bfb5c3a8330002250f304cb5deb522fa054eae.tar.xz
musl-b7bfb5c3a8330002250f304cb5deb522fa054eae.zip
fix iconv conversions for iso88592-iso885916
commit 97bd6b09dbe7478d5a90a06ecd9e5b59389d8eb9 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.
Diffstat (limited to 'src')
-rw-r--r--src/locale/iconv.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/locale/iconv.c b/src/locale/iconv.c
index 4636307f..fd2f2e01 100644
--- a/src/locale/iconv.c
+++ b/src/locale/iconv.c
@@ -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)
 {
-	unsigned x = c - 128 + map[-1];
+	unsigned x = c - 128 - map[-1];
 	x = legacy_chars[ map[x*5/4]>>2*x%8 |
 		map[x*5/4+1]<<8-2*x%8 & 1023 ];
 	return x ? x : c;