Commit Graph

20 Commits

Author SHA1 Message Date
Peter Jones f725fa7cb2 calloc: Use calloc() at most places
This modifies most of the places we do some form of:

  X = malloc(Y * Z);

to use calloc(Y, Z) instead.

Among other issues, this fixes:
  - allocation of integer overflow in grub_png_decode_image_header()
    reported by Chris Coulson,
  - allocation of integer overflow in luks_recover_key()
    reported by Chris Coulson,
  - allocation of integer overflow in grub_lvm_detect()
    reported by Chris Coulson.

Fixes: CVE-2020-14308

Signed-off-by: Peter Jones <pjones@redhat.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2020-07-29 16:55:47 +02:00
Andrey Borzenkov 954fe77163 cleanup: grub_cpu_to_XXX_compile_time for constants
This tries to catch all cases where grub_cpu_to_XXX was used for constant
expressions (including sizeof).
2014-09-22 20:47:10 +04:00
Vladimir Serbinenko 7e47e27bd8 Add gcc_struct to all packed structures when compiling with mingw.
Just "packed" doesn't always pack the way we expect.
2013-12-15 14:14:30 +01:00
Vladimir Serbinenko c311ced5d7 Make arm-emu work. 2013-12-08 02:59:21 +01:00
Vladimir Serbinenko 79054c1d1e * grub-core/tests/video_checksum.c: Add 2560x1440 mode to testing. 2013-11-04 00:40:14 +01:00
Vladimir 'phcoder' Serbinenko 99519c154c * grub-core/tests/video_checksum.c (grub_video_capture_write_bmp):
Use GRUB_UTIL_FD_O_* rather than O_*.
2013-10-19 23:48:24 +02:00
Vladimir 'phcoder' Serbinenko f4e0adc0f9 Remove leftover references to some of the system headers. 2013-10-15 17:59:54 +02:00
Vladimir 'phcoder' Serbinenko 7e45abcef4 Move cpu time retrieval to separate grub_util_get_cpu_time_ms
and remove export.h.
2013-10-15 13:13:53 +02:00
Vladimir 'phcoder' Serbinenko 25ac643a54 * grub-core/tests/video_checksum.c: Use grub_util_fd_* rather than
open/read/write.
2013-10-15 11:06:57 +02:00
Vladimir 'phcoder' Serbinenko d71b45ae8e * grub-core/tests/video_checksum.c: Increase robustness to out of memory
condition.
	* grub-core/tests/fake_input.c: Likewise.
	* grub-core/tests/cmdline_cat_test.c: Likewise.
2013-10-03 23:38:18 +02:00
Vladimir 'phcoder' Serbinenko cdce14fad4 Progressively skip menu elements on small terminals rather
than crashing.
2013-05-14 08:57:18 +02:00
Vladimir 'phcoder' Serbinenko 0e7b2e3217 New test: cmdline and cat. 2013-05-08 11:49:25 +02:00
Vladimir 'phcoder' Serbinenko c5dbc13d28 Menu color test. 2013-05-07 14:38:29 +02:00
Vladimir 'phcoder' Serbinenko 85002bf34a Agglomerate more mallocs to speed-up gfxterm. 2013-05-04 22:23:23 +02:00
Vladimir 'phcoder' Serbinenko b7c036bce3 More video checks. 2013-05-04 14:00:14 +02:00
Andrey Borzenkov 8cec7bd40b Rename grub-core/tests/checksums.c into grub-core/tests/checksums.h
and add it as source to functional_test module.
2013-05-03 18:39:17 +04:00
Vladimir 'phcoder' Serbinenko aa73d688e7 * grub-core/tests/video_checksum.c: Don't set GENERATE_MODE. 2013-05-03 14:50:05 +02:00
Vladimir 'phcoder' Serbinenko c104b6f93e New series of tests for gfxterm and gfxmenu. 2013-05-03 14:09:55 +02:00
Vladimir 'phcoder' Serbinenko a8905e8ae8 Several fixes to ieee1275 and big-endian video. 2013-05-02 22:30:20 +02:00
Vladimir 'phcoder' Serbinenko 5036166022 First automated video test (running videotest and comparing results) 2013-05-02 14:39:03 +02:00