Skip to content
Snippets Groups Projects
Commit d84e89f4 authored by Peter Jones's avatar Peter Jones Committed by Colin Watson
Browse files

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: default avatarPeter Jones <pjones@redhat.com>
Reviewed-by: default avatarDaniel Kiper <daniel.kiper@oracle.com>

Patch-Name: safe-alloc-4.patch
parent 65dfa117
No related branches found
No related tags found
No related merge requests found
Showing
with 337 additions and 99 deletions
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