Skip to content
Snippets Groups Projects
Commit afa02a1b authored by Zhang Boyang's avatar Zhang Boyang Committed by Steve McIntyre
Browse files

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: default avatarDaniel Axtens <dja@axtens.net>
Signed-off-by: default avatarZhang Boyang <zhangboyang.id@gmail.com>
Reviewed-by: default avatarDaniel Kiper <daniel.kiper@oracle.com>
parent b272bbd4
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment