grub2/grub-core/normal
Peter Jones d84e89f473 malloc: Use overflow checking primitives where we do complex allocations
This attempts to fix the places where we do the following where
arithmetic_expr may include unvalidated data:

  X = grub_malloc(arithmetic_expr);

It accomplishes this by doing the arithmetic ahead of time using grub_add(),
grub_sub(), grub_mul() and testing for overflow before proceeding.

Among other issues, this fixes:
  - allocation of integer overflow in grub_video_bitmap_create()
    reported by Chris Coulson,
  - allocation of integer overflow in grub_png_decode_image_header()
    reported by Chris Coulson,
  - allocation of integer overflow in grub_squash_read_symlink()
    reported by Chris Coulson,
  - allocation of integer overflow in grub_ext2_read_symlink()
    reported by Chris Coulson,
  - allocation of integer overflow in read_section_as_string()
    reported by Chris Coulson.

Fixes: CVE-2020-14309, CVE-2020-14310, CVE-2020-14311

Signed-off-by: Peter Jones <pjones@redhat.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>

Patch-Name: safe-alloc-4.patch
2020-07-24 22:42:22 +01:00
..
auth.c core: use GRUB_TERM_ definitions when handling term characters 2017-08-07 19:28:22 +02:00
autofs.c verifiers: File type for fine-grained signature-verification controlling 2018-11-09 13:25:31 +01:00
charset.c malloc: Use overflow checking primitives where we do complex allocations 2020-07-24 22:42:22 +01:00
cmdline.c malloc: Use overflow checking primitives where we do complex allocations 2020-07-24 22:42:22 +01:00
color.c Replace explicit sizeof divisions by ARRAY_SIZE. 2015-01-21 17:37:31 +01:00
completion.c Change fs functions to add fs_ prefix 2019-04-09 10:03:29 +10:00
context.c normal: fix memory leak 2015-06-20 23:38:19 +03:00
crypto.c verifiers: File type for fine-grained signature-verification controlling 2018-11-09 13:25:31 +01:00
datetime.c * grub-core/normal/datetime.c (grub_get_weekday): Use if rather than 2013-11-13 09:26:13 +01:00
dyncmd.c verifiers: File type for fine-grained signature-verification controlling 2018-11-09 13:25:31 +01:00
main.c Add configure option to reduce visual clutter at boot time 2020-03-07 12:21:23 +00:00
menu_entry.c malloc: Use overflow checking primitives where we do complex allocations 2020-07-24 22:42:22 +01:00
menu_text.c calloc: Use calloc() at most places 2020-07-24 22:42:16 +01:00
menu.c Add configure option to bypass boot menu if possible 2020-03-07 12:21:23 +00:00
misc.c Change fs functions to add fs_ prefix 2019-04-09 10:03:29 +10:00
term.c calloc: Use calloc() at most places 2020-07-24 22:42:16 +01:00