normal/charset: Fix an integer overflow in grub_unicode_aglomerate_comb()
The out->ncomb is a bit-field of 8 bits. So, the max possible value is 255. However, code in grub_unicode_aglomerate_comb() doesn't check for an overflow when incrementing out->ncomb. If out->ncomb is already 255, after incrementing it will get 0 instead of 256, and cause illegal memory access in subsequent processing. This patch introduces GRUB_UNICODE_NCOMB_MAX to represent the max acceptable value of ncomb. The code now checks for this limit and ignores additional combining characters when limit is reached. Reported-by:Daniel Axtens <dja@axtens.net> Signed-off-by:
Zhang Boyang <zhangboyang.id@gmail.com> Reviewed-by:
Daniel Kiper <daniel.kiper@oracle.com>
Showing
- debian/patches/cve_2022_2601/0014-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch 55 additions, 0 deletions...ormal-charset-Fix-an-integer-overflow-in-grub_unico.patch
- grub-core/normal/charset.c 3 additions, 0 deletionsgrub-core/normal/charset.c
- include/grub/unicode.h 2 additions, 0 deletionsinclude/grub/unicode.h
Please register or sign in to comment