Commit Graph

37 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
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 a28567364a Make char and string width grub_size_t rather than grub_ssize_t. 2013-10-25 23:58:24 +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 85002bf34a Agglomerate more mallocs to speed-up gfxterm. 2013-05-04 22:23:23 +02:00
Vladimir 'phcoder' Serbinenko 22b06e9685 Speed-up gfxterm by slightly agglomerating mallocs. 2013-05-04 15:07:13 +02:00
Vladimir 'phcoder' Serbinenko 19e29ee1a9 * grub-core/normal/charset.c (grub_bidi_logical_to_visual): Add
hook pass-through parameter. All users updated and unnested.
2013-03-02 11:47:59 +01:00
Vladimir 'phcoder' Serbinenko 34f71cb866 Improve bidi handling in entry editor. 2013-01-16 13:41:16 +01:00
Vladimir 'phcoder' Serbinenko 4e5a96b02e Remove dor on i and j when combining with above diacritics.
* include/grub/unicode.h (GRUB_UNICODE_DOTLESS_LOWERCASE_I): New enum
	value.
	(GRUB_UNICODE_DOTLESS_LOWERCASE_J): Likewise.
	* grub-core/font/font.c (grub_font_construct_dry_run): Replace i and j
	with dotless variants when any combining above is present.
2012-06-11 00:20:55 +02:00
Vladimir 'phcoder' Serbinenko e1bd676b4e Fix tab and wide character handling in editor and menu.
* grub-core/normal/charset.c (grub_unicode_aglomerate_comb): Don't
	agglomerate control characters with combining marks.
	(bidi_line_wrap): Allow break on tab.
	(grub_unicode_get_comb_start): New function.
	* grub-core/normal/menu_entry.c: Restructure to handle wide characters
	and tab correctly.
	* grub-core/normal/menu_text.c (print_entry): Replace \n, \r, \b and \e
	with a space.
	* grub-core/normal/term.c (print_ucs4_terminal): New argument
	fixed_tab_size. All users updated.
	* include/grub/term.h (GRUB_TERM_TAB_WIDTH): New const.
	(grub_term_getcharwidth): Handle \t.
	* include/grub/unicode.h (grub_unicode_glyph_dup): Fix allocation
	and copy.
2012-03-27 17:07:26 +02:00
Vladimir 'phcoder' Serbinenko f3cb4a4e57 * grub-core/normal/charset.c (grub_ucs4_to_utf8): Small stylistic fix.
(grub_bidi_line_logical_to_visual): Skip tags. They are deprecated.
	* include/grub/unicode.h (GRUB_UNICODE_TAG_START): New enum value.
	(GRUB_UNICODE_TAG_END): Likewise.
	(GRUB_UNICODE_LAST_VALID): Likewise.
2011-12-25 16:07:33 +01:00
Vladimir 'phcoder' Serbinenko 5da8dbc5bc * include/grub/unicode.h (grub_unicode_compact_range): Replace end with
len and make it smaller. All users updated.
	* util/import_unicode.py: Put length and not end character.
	Check length.
2011-12-25 16:03:42 +01:00
Vladimir 'phcoder' Serbinenko d7fd78dc3d macroify EFI characters mapping 2010-05-09 13:20:35 +02:00
Vladimir 'phcoder' Serbinenko b764bff263 Move arrow number into unicode characters array 2010-05-09 12:56:32 +02:00
Vladimir 'phcoder' Serbinenko 483c5e7d47 Transform remarkable unicode codepoints into enum 2010-03-29 13:36:08 +02:00
Vladimir 'phcoder' Serbinenko 0546172e3e Basic thaana support 2010-03-29 13:31:03 +02:00
Vladimir 'phcoder' Serbinenko e2588ccbfe Alif and alaph superscripts 2010-03-29 13:01:08 +02:00
Vladimir 'phcoder' Serbinenko ad109fe056 Arabic diacritics support 2010-03-29 04:11:14 +02:00
Vladimir 'phcoder' Serbinenko a82890fffc Shape arabic code when on UTF-8 visual 2010-03-29 03:37:24 +02:00
Vladimir 'phcoder' Serbinenko 3f11c7131e Generate shaping table based on unicode if source font has none 2010-03-29 02:06:40 +02:00
Vladimir 'phcoder' Serbinenko 03e4ef0293 Import data for arabic joining computation 2010-03-24 00:35:38 +01:00
Vladimir 'phcoder' Serbinenko 832d13705c Most hebrew diacritics support (except dagesh and final kaf rules) 2010-03-23 21:50:27 +01:00
Vladimir 'phcoder' Serbinenko 7624beba47 Above left support. Various fixups 2010-03-23 19:13:46 +01:00
Vladimir 'phcoder' Serbinenko 45511ee976 below right support 2010-03-23 18:39:02 +01:00
Vladimir 'phcoder' Serbinenko 09f9aa3b2e Move terminal-related function from normal/charset.c to normal/term.c 2010-03-17 08:57:23 +01:00
Vladimir 'phcoder' Serbinenko eaa1f9a64b Fix few memory errors 2010-03-16 23:03:08 +01:00
Vladimir 'phcoder' Serbinenko 6f5568ed67 Add mirroring for visual UTF-8 2010-03-16 21:57:34 +01:00
Vladimir 'phcoder' Serbinenko 50186d826d Fix combining characters messing with width counter 2010-03-16 19:55:09 +01:00
Vladimir 'phcoder' Serbinenko 97b3fbb872 Handle initial position in bidi 2010-03-16 10:55:06 +01:00
Vladimir 'phcoder' Serbinenko 53c648d2eb Break few dependencies on normal 2010-03-15 22:12:34 +01:00
Vladimir 'phcoder' Serbinenko 0a239a8211 bidi works in terminal in grub-emu 2010-03-15 21:14:11 +01:00
Vladimir 'phcoder' Serbinenko 1876cfdb56 GCJ 2010-02-08 02:01:10 +01:00
Vladimir 'phcoder' Serbinenko 9d9dca02d9 Type 240 2010-02-08 01:44:06 +01:00
Vladimir 'phcoder' Serbinenko 4361ca1c37 Restructure rendering to make extensions easier 2010-01-08 18:48:41 +01:00
Vladimir 'phcoder' Serbinenko 82c5d8dcfc Support for 3 more combining marks types 2010-01-08 00:46:42 +01:00
Vladimir 'phcoder' Serbinenko 97ea65d432 Add mirroring and stacked combining marks 2010-01-07 21:25:56 +01:00
Vladimir 'phcoder' Serbinenko 72f12cdcd9 Group combining diacritics 2010-01-07 16:37:53 +01:00