[PATCH] [iconvdata] Fix possible bad array index.

Dmitry Chestnyh d.chestnyh@omp.ru
Fri Apr 1 07:53:28 GMT 2022


`__jisx0213_to_ucs_combining` is array of 25 pairs,
so the maximum valid `ch - 1` index is 24.
---
 iconvdata/euc-jisx0213.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/iconvdata/euc-jisx0213.c b/iconvdata/euc-jisx0213.c
index 0460d11953..977dadb751 100644
--- a/iconvdata/euc-jisx0213.c
+++ b/iconvdata/euc-jisx0213.c
@@ -194,6 +194,7 @@
 									      \
 		if (ch < 0x80)						      \
 		  {							      \
+		    assert(ch <= 25);					      \
 		    /* It's a combining character.  */			      \
 		    uint32_t u1 = __jisx0213_to_ucs_combining[ch - 1][0];     \
 		    uint32_t u2 = __jisx0213_to_ucs_combining[ch - 1][1];     \
-- 
2.25.1



More information about the Libc-alpha mailing list