mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2025-05-28 00:30:23 -04:00
qoi: fix reports from quality scanner
struct QoiHeader is initialized to invalid values prior use, it’s good to detect situations when we read incomplete data. Add include in scanlineconverter.cpp so it can be used without change in kf5 branch.
This commit is contained in:
parent
9173f02ea3
commit
2aea982e9e
@ -141,7 +141,7 @@ static bool LoadQOI(QIODevice *device, const QoiHeader &qoi, QImage &img)
|
||||
|
||||
quint64 chunks_len = ba.size() - QOI_END_STREAM_PAD;
|
||||
quint64 p = 0;
|
||||
QRgb *scanline = (QRgb *)img.scanLine(y);
|
||||
QRgb *scanline = reinterpret_cast<QRgb *>(img.scanLine(y));
|
||||
const quint8 *input = reinterpret_cast<const quint8 *>(ba.constData());
|
||||
for (quint32 x = 0; x < qoi.Width; ++x) {
|
||||
if (run > 0) {
|
||||
@ -328,7 +328,7 @@ bool QOIHandler::canRead(QIODevice *device)
|
||||
|
||||
QDataStream stream(head);
|
||||
stream.setByteOrder(QDataStream::BigEndian);
|
||||
QoiHeader qoi;
|
||||
QoiHeader qoi = {0, 0, 0, 0, 2};
|
||||
stream >> qoi;
|
||||
|
||||
return IsSupported(qoi);
|
||||
@ -340,7 +340,7 @@ bool QOIHandler::read(QImage *image)
|
||||
s.setByteOrder(QDataStream::BigEndian);
|
||||
|
||||
// Read image header
|
||||
QoiHeader qoi;
|
||||
QoiHeader qoi = {0, 0, 0, 0, 2};
|
||||
s >> qoi;
|
||||
|
||||
// Check if file is supported
|
||||
|
@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include "scanlineconverter_p.h"
|
||||
#include <cstring>
|
||||
|
||||
ScanLineConverter::ScanLineConverter(const QImage::Format &targetFormat)
|
||||
: _targetFormat(targetFormat)
|
||||
|
Loading…
Reference in New Issue
Block a user