grub/grub-core/script
Peter Jones 3f05d693d1 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>
2020-07-29 16:55:47 +02:00
..
argv.c malloc: Use overflow checking primitives where we do complex allocations 2020-07-29 16:55:47 +02:00
execute.c calloc: Use calloc() at most places 2020-07-29 16:55:47 +02:00
function.c Improve string. Gettextize. 2012-02-12 15:25:25 +01:00
lexer.c malloc: Use overflow checking primitives where we do complex allocations 2020-07-29 16:55:47 +02:00
main.c Remove nested functions from script reading and parsing. 2013-01-15 12:03:25 +00:00
parser.y Remove pragmas related to -Wunreachable-code 2016-01-20 15:56:55 +00:00
script.c Remove nested functions from script reading and parsing. 2013-01-15 12:03:25 +00:00
yylex.l yylex: Make lexer fatal errors actually be fatal 2020-07-29 16:55:47 +02:00