Fix: png handler returning Mono QImage with color table < 2 items
A bit depth 1 png image may contain a single color table item. The png handler would in such cases reduce the size of the QImage color table to 1, which could easily lead to crashes later on. Task-number: QTBUG-69256 Change-Id: I01d78977c121bacc44b823231d8f32ca63d8a98c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>bb10
parent
b0797cfed6
commit
9a3359b57b
|
|
@ -328,7 +328,7 @@ void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, QSize scal
|
|||
return;
|
||||
}
|
||||
png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette);
|
||||
image.setColorCount(num_palette);
|
||||
image.setColorCount((format == QImage::Format_Mono) ? 2 : num_palette);
|
||||
int i = 0;
|
||||
if (png_get_tRNS(png_ptr, info_ptr, &trans_alpha, &num_trans, &trans_color_p) && trans_alpha) {
|
||||
while (i < num_trans) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue