DDS: fix buffer overflow in readCubeMap

The issue was identified by OSS Fuzz and the feature was not covered by our tests.

- Added earth-cubemap.dds under MIT licenses taken from [Open Toolkit library](https://github.com/mono/opentk/tree/main/Source/Examples/Data/Textures)
- Fix a wrong image size returned by a cubemap image
- Read test skips .license files
This commit is contained in:
Mirco Miranda
2024-12-12 09:42:24 +00:00
committed by Albert Astals Cid
parent 87eff569a4
commit ecbcf3b7f4
7 changed files with 29 additions and 4 deletions

Binary file not shown.

View File

@ -0,0 +1,2 @@
SPDX-FileCopyrightText: Copyright (c) 2006 - 2010 The Open Toolkit library.
SPDX-License-Identifier: MIT

Binary file not shown.

After

Width:  |  Height:  |  Size: 956 KiB

View File

@ -263,7 +263,7 @@ int main(int argc, char **argv)
}
for (const QFileInfo &fi : lstImgDir) {
TemplateImage timg(fi);
if (timg.isTemplate()) {
if (timg.isTemplate() || timg.isLicense()) {
continue;
}

View File

@ -28,6 +28,11 @@ bool TemplateImage::isTemplate() const
return false;
}
bool TemplateImage::isLicense() const
{
return !m_fi.suffix().compare(QStringLiteral("license"), Qt::CaseInsensitive);
}
QFileInfo TemplateImage::compareImage(TestFlags &flags, QString& comment) const
{
auto fi = jsonImage(flags, comment);

View File

@ -47,6 +47,12 @@ public:
*/
bool isTemplate() const;
/*!
* \brief isLicense
* \return True if the file suffix is .license
*/
bool isLicense() const;
/*!
* \brief compareImage
* \param flags Flags for modifying test behavior (e.g. image format not supported by current Qt version).