]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
lcd: fix integer overflow in calculation of number of colors
authorLothar Waßmann <LW@KARO-electronics.de>
Wed, 3 Feb 2016 06:16:20 +0000 (07:16 +0100)
committerLothar Waßmann <LW@KARO-electronics.de>
Wed, 3 Feb 2016 06:16:20 +0000 (07:16 +0100)
common/lcd.c

index d62e292412bcc5058ec50ada64e61c7085dfce32..e8c18aa0d842330c37e41708e1c7e14e4f069276 100644 (file)
@@ -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);
 
        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);
 
 
        bpix = NBITS(panel_info.vl_bpix);
 
@@ -644,8 +644,8 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
                return 1;
        }
 
                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);
 
        if (bmp_bpix == 8)
                lcd_set_cmap(bmp, colors);