1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-23 19:25:54 +01:00

Check the image data size

This commit is contained in:
Martin Tůma 2022-01-23 20:58:40 +01:00
parent c0e2597dcc
commit 2c770d3756

View File

@ -654,13 +654,15 @@ static quint32 readSymbol(DataStream &stream, QPixmap &pixmap)
ds += paletteSize * 4;
}
if (paletteSize) {
img = QImage((uchar*)data.data(), width, height, lineSize,
QImage::Format_Indexed8);
img.setColorTable(palette);
} else
img = QImage((uchar*)data.data(), width, height, lineSize,
QImage::Format_RGBX8888).rgbSwapped();
if (imageSize >= lineSize * height) {
if (paletteSize) {
img = QImage((uchar*)data.data(), width, height, lineSize,
QImage::Format_Indexed8);
img.setColorTable(palette);
} else
img = QImage((uchar*)data.data(), width, height, lineSize,
QImage::Format_RGBX8888).rgbSwapped();
}
pixmap = QPixmap::fromImage(img);
/* There should be no more data left in the record, but broken GPI files