mirror of
https://github.com/php/php-src.git
synced 2026-03-31 04:32:19 +02:00
Fix legacy conversion filter for ISO-2022-KR
When I was working on this code before, it really, really looked like the index into `uhc3_ucs_table` could never overrun the size of the table. Why did I get this wrong? Don't know. Anyways, libfuzzer tore away my illusions and unequivocally demonstrated that the index CAN be larger than the size of the table.
This commit is contained in:
@@ -125,8 +125,11 @@ int mbfl_filt_conv_2022kr_wchar(int c, mbfl_convert_filter *filter)
|
||||
}
|
||||
} else {
|
||||
w = (c1 - 0x47)*94 + c - 0x21;
|
||||
ZEND_ASSERT(w < uhc3_ucs_table_size);
|
||||
w = uhc3_ucs_table[w];
|
||||
if (w < uhc3_ucs_table_size) {
|
||||
w = uhc3_ucs_table[w];
|
||||
} else {
|
||||
w = MBFL_BAD_INPUT;
|
||||
}
|
||||
}
|
||||
|
||||
if (w <= 0) {
|
||||
|
||||
Reference in New Issue
Block a user