From 5121b8df014a80499a0d683f668804178daf0bac Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lothar=20Wa=C3=9Fmann?= Date: Wed, 3 Feb 2016 07:16:20 +0100 Subject: [PATCH] lcd: fix integer overflow in calculation of number of colors --- common/lcd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/lcd.c b/common/lcd.c index d62e292412..e8c18aa0d8 100644 --- a/common/lcd.c +++ b/common/lcd.c @@ -621,7 +621,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y) hdr_size = get_unaligned_le16(&bmp->header.size); debug("hdr_size=%d, bmp_bpix=%d\n", hdr_size, bmp_bpix); - colors = 1 << bmp_bpix; + colors = 1ULL << bmp_bpix; bpix = NBITS(panel_info.vl_bpix); @@ -644,8 +644,8 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y) return 1; } - debug("Display-bmp: %lu x %lu with %llu colors, display %d\n", - width, height, colors, NBITS(bmp_bpix)); + debug("Display-bmp: %lu x %lu with %llu colors, display %llu\n", + width, height, colors, 1ULL << bpix); if (bmp_bpix == 8) lcd_set_cmap(bmp, colors); -- 2.39.2