1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 03:35:53 +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; ds += paletteSize * 4;
} }
if (paletteSize) { if (imageSize >= lineSize * height) {
img = QImage((uchar*)data.data(), width, height, lineSize, if (paletteSize) {
QImage::Format_Indexed8); img = QImage((uchar*)data.data(), width, height, lineSize,
img.setColorTable(palette); QImage::Format_Indexed8);
} else img.setColorTable(palette);
img = QImage((uchar*)data.data(), width, height, lineSize, } else
QImage::Format_RGBX8888).rgbSwapped(); img = QImage((uchar*)data.data(), width, height, lineSize,
QImage::Format_RGBX8888).rgbSwapped();
}
pixmap = QPixmap::fromImage(img); pixmap = QPixmap::fromImage(img);
/* There should be no more data left in the record, but broken GPI files /* There should be no more data left in the record, but broken GPI files