Compare commits

..
Author SHA1 Message Date
Nicolas FellaandMirco Miranda 4d8501d541 Enable LSAN in CI
To check for leaks
2026-07-09 16:27:07 +02:00
198 changed files with 688 additions and 1341 deletions
+2 -1
View File
@@ -7,5 +7,6 @@ Dependencies:
Options:
test-before-installing: True
require-passing-tests-on: ['Linux', 'FreeBSD', 'Windows']
cmake-options: "-DKIMAGEFORMATS_WITH_KNOWN_CRASHES_JXR=ON -DKIMAGEFORMATS_HEIF=ON -DKIMAGEFORMATS_HEIC_TEST:STRING=OFF -DKIMAGEFORMATS_HEIF_TEST:STRING=OFF -DKIMAGEFORMATS_HEJ2_TEST:STRING=OFF -DKIMAGEFORMATS_AVCI_TEST:STRING=OFF"
cmake-options: "-DKIMAGEFORMATS_WITH_KNOWN_CRASHES_JXR=ON -DKIMAGEFORMATS_HEIF=ON -DKIMAGEFORMATS_HEIF_TEST:STRING=OFF -DKIMAGEFORMATS_HEJ2_TEST:STRING=OFF -DKIMAGEFORMATS_AVCI_TEST:STRING=OFF"
per-test-timeout: 90
enable-lsan: True
+9 -8
View File
@@ -1,11 +1,11 @@
cmake_minimum_required(VERSION 3.29)
set(KF_VERSION "6.31.0") # handled by release scripts
set(KF_DEP_VERSION "6.30.0") # handled by release scripts
set(KF_VERSION "6.29.0") # handled by release scripts
set(KF_DEP_VERSION "6.28.0") # handled by release scripts
project(KImageFormats VERSION ${KF_VERSION})
include(FeatureSummary)
find_package(ECM 6.30.0 NO_MODULE)
find_package(ECM 6.28.0 NO_MODULE)
set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://commits.kde.org/extra-cmake-modules")
feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES)
@@ -53,7 +53,10 @@ set_package_properties(OpenEXR PROPERTIES
PURPOSE "Required for the QImage plugin for OpenEXR images"
)
find_package(libavif 1 CONFIG)
find_package(libavif 0.8.2 CONFIG QUIET)
if(NOT libavif_FOUND)
find_package(libavif 1 CONFIG)
endif()
set_package_properties(libavif PROPERTIES
TYPE OPTIONAL
PURPOSE "Required for the QImage plugin for AVIF images"
@@ -62,10 +65,8 @@ set_package_properties(libavif PROPERTIES
option(KIMAGEFORMATS_DDS "Enable plugin for DDS format" ON)
option(KIMAGEFORMATS_HEIF "Enable plugin for HEIF format" OFF)
set(KIMAGEFORMATS_HEIC_TEST "ALL" CACHE STRING "Enable HEIC tests: OFF, READ_ONLY, ALL")
set_property(CACHE KIMAGEFORMATS_HEIC_TEST PROPERTY STRINGS "OFF" "READ_ONLY" "ALL")
set(KIMAGEFORMATS_HEIF_TEST "ALL" CACHE STRING "Enable HEIF tests: OFF, ALL")
set_property(CACHE KIMAGEFORMATS_HEIF_TEST PROPERTY STRINGS "OFF" "ALL")
set(KIMAGEFORMATS_HEIF_TEST "ALL" CACHE STRING "Enable HEIF tests: OFF, READ_ONLY, ALL")
set_property(CACHE KIMAGEFORMATS_HEIF_TEST PROPERTY STRINGS "OFF" "READ_ONLY" "ALL")
set(KIMAGEFORMATS_HEJ2_TEST "ALL" CACHE STRING "Enable HEJ2 tests: OFF, READ_ONLY, ALL")
set_property(CACHE KIMAGEFORMATS_HEJ2_TEST PROPERTY STRINGS "OFF" "READ_ONLY" "ALL")
set(KIMAGEFORMATS_AVCI_TEST "ALL" CACHE STRING "Enable AVCI tests: OFF, ALL")
+15 -39
View File
@@ -31,13 +31,13 @@ The following image formats have read-only support:
The following image formats have read and write support:
- AV1 Image File Format (avif, avifs<sup>1</sup>)
- AV1 Image File Format (avif)
- DirectDraw Surface (dds)
- Encapsulated PostScript (eps)
- High Efficiency Image File Format (avci<sup>2</sup>, heic<sup>2</sup>, heif<sup>2</sup>, hej2<sup>2</sup>, hif<sup>2</sup>)
- JPEG 2000 (jp2, j2k, jpf<sup>1</sup>)
- High Efficiency Image File Format (heif)
- JPEG 2000 (jp2, j2k, jpf)
- JPEG XL (jxl)
- JPEG XR (jxr, hdp<sup>1</sup>, wdp<sup>1</sup>)
- JPEG XR (jxr)
- OpenEXR (exr)
- Personal Computer Exchange (pcx)
- Quite OK Image format (qoi)
@@ -45,11 +45,6 @@ The following image formats have read and write support:
- Softimage PIC (pic)
- Targa (tga): supports more formats than Qt's version
Footnotes:
1. Read only support.
2. It depends on the HEIF plugins installed.
## Contributing
See the [`QImageIOPlugin`](https://doc.qt.io/qt-6/qimageioplugin.html)
@@ -151,7 +146,6 @@ About the image:
scanned.
- `HostComputer`: The computer and/or operating system in use at the time
of image creation.
- `Keywords`: Keywords, separated by semicolons, that represent the image.
- `Latitude`: Floating-point number indicating the latitude in degrees
north of the equator (e.g. 27.717).
- `Longitude`: Floating-point number indicating the longitude in degrees
@@ -160,8 +154,6 @@ About the image:
without milliseconds (e.g. 2024-03-23T15:30:43). This value should be
updated every time the image is saved.
- `Owner`: Name of the owner of the image.
- `Rating`: Integer number indicating the image rating (usually between 1
and 5).
- `Software`: Name and version number of the software package(s) used to
create the image.
- `Speed`: Floating-point number indicating the speed of GPS receiver
@@ -365,18 +357,12 @@ plugin:
**If you are interested in compiling the plugin without running the tests,
also use the following string options:**
- `KIMAGEFORMATS_HEIC_TEST` to change the behaviour of HEIC tests. Set to
- `KIMAGEFORMATS_HEIF_TEST` to change the behaviour of HEIF tests. Set to
`"OFF"` (no test at all) or `"READ_ONLY"` (run read tests only).
Required codecs: HEVC / H.265.
- `KIMAGEFORMATS_HEIF_TEST` to change the behaviour of HEIF tests. Set to
`"OFF"` (no test at all).
Required codecs: uncompressed, deflate, zlib, brotli, jpeg.
- `KIMAGEFORMATS_HEJ2_TEST` to change the behaviour of HEJ2 tests. Set to
`"OFF"` (no test at all) or `"READ_ONLY"` (run read tests only).
Required codecs: JPEG 2000.
- `KIMAGEFORMATS_AVCI_TEST` to change the behaviour of AVCI tests. Set to
`"OFF"` (no test at all).
Required codecs: Advanced Video Coding / H.264.
### The EXR plugin
@@ -392,22 +378,6 @@ The plugin can set the following additional metadata:
- `EXRLayerName`: A string containing the name of the EXR layer used to decode
the image.
When writing, it is possible to specify compression ratio and quality. The
values you can set depend on the version of the OpenEXR library you're using.
Please check the [exr_p.h](./src/imageformats/exr_p.h) for more
info.
When writing, it is also possible to specify a subtype:
- `RGB` (default): preserves full-resolution color data (R, G, B) without
subsampling or loss of chromatic detail.
- `YC`: converts RGB data into luminance (Y) and 2x2 subsampled chroma
(RY, BY), cutting raw color data by ~50% for significantly smaller file
sizes. **If the image does not have a height and width that are multiples
of 2, `RGB` is used.**
> [!note]
> When writing grayscale images, the subtype makes no difference.
### The EPS plugin
The plugin uses `Ghostscript` to convert the raster image. When reading it
@@ -445,7 +415,7 @@ The plugin supports the following image data:
with color map only.
- FORM IMAG (Compact Disc-Interactive): It supports CLut4, CLut7, CLut8, Rle7
and DYuv formats.
- FORM RGFX: It supports uncompressed and ZIP compressed images.
- FORM RGFX: It supports uncompressed images only.
- FORM DEEP: It supports uncompressed, RLE and TVDC images.
- FOR4 CIMG (Maya Image File Format): It supports 24/48-bit RGB and 32/64-bit
RGBA images.
@@ -509,10 +479,16 @@ plugin:
this format an hack is activated to guarantee total compatibility of the
plugin with Windows.
### The KRA and ORA plugin
### The KRA plugin
Both KRA and ORA formats are ZIP archives containing image data. Specifically,
the rendered PNG image is saved in the root directory: the plugin reads this
The KRA format is a ZIP archive containing image data. In particular, the
rendered image in PNG format is saved in the root: the plugin reads this
image.
### The ORA plugin
The ORA format is a ZIP archive containing image data. In particular, the
rendered image in PNG format is saved in the root: the plugin reads this
image.
### The PSD plugin
+7 -13
View File
@@ -119,23 +119,17 @@ if (TARGET avif)
endif()
if (LibHeif_FOUND)
if (KIMAGEFORMATS_HEIC_TEST STREQUAL "ALL" OR KIMAGEFORMATS_HEIC_TEST STREQUAL "READ_ONLY")
kimageformats_read_tests(
heic
)
endif()
if (KIMAGEFORMATS_HEIC_TEST STREQUAL "ALL")
# because the plug-ins use RGB->YUV conversion which sometimes results in 1 value difference.
kimageformats_write_tests(FUZZ 1
heic-nodatacheck-lossless
)
endif()
if (KIMAGEFORMATS_HEIF_TEST STREQUAL "ALL")
if (KIMAGEFORMATS_HEIF_TEST STREQUAL "ALL" OR KIMAGEFORMATS_HEIF_TEST STREQUAL "READ_ONLY")
kimageformats_read_tests(
heif
)
endif()
if (KIMAGEFORMATS_HEIF_TEST STREQUAL "ALL")
# because the plug-ins use RGB->YUV conversion which sometimes results in 1 value difference.
kimageformats_write_tests(FUZZ 1
heif-nodatacheck-lossless
)
endif()
if (LibHeif_VERSION VERSION_GREATER_EQUAL "1.17.0")
if (KIMAGEFORMATS_HEJ2_TEST STREQUAL "ALL" OR KIMAGEFORMATS_HEJ2_TEST STREQUAL "READ_ONLY")
+1 -5
View File
@@ -23,11 +23,7 @@ e.g. PSD plugin).
The reading tests are mainly based on comparing the image read by the plugin
with a template in a known and working format. For this reason, the template
formats chosen are those distributed by the Qt project: PNG in the first
instance, TIFF for image formats not supported by PNG (e.g. CMYK images) and,
as a last choice, lossy JPG for large images.
> [!important]
> Keep the size of individual test images on the order of a few tens of KiB.
instance and TIFF for image formats not supported by PNG (e.g. CMYK images).
Some image options such as `QImageIOHandler::Size`,
`QImageIOHandler::ImageFormat` and `QImageIOHandler::ImageTransformation` are
+58 -55
View File
@@ -26,8 +26,8 @@ export LDFLAGS
# build zstd
cd $SRC/zstd
cmake -G Ninja -S build/cmake -DBUILD_SHARED_LIBS=OFF -DZSTD_BUILD_PROGRAMS=OFF -DBUILD_TESTING=OFF
ninja install
cmake -S build/cmake -DBUILD_SHARED_LIBS=OFF
make install -j$(nproc)
# Build zlib
cd $SRC/zlib
@@ -70,13 +70,13 @@ cmake --install .
# Build extra-cmake-modules
cd $SRC/extra-cmake-modules
cmake -G Ninja . -DBUILD_TESTING=OFF -DBUILD_DOC=OFF
ninja install
cmake . -DBUILD_TESTING=OFF
make install -j$(nproc)
cd $SRC/karchive
rm -rf poqm
cmake -G Ninja . -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=/usr/local
ninja install
cmake . -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=/usr/local
make install -j$(nproc)
# Build JXRlib
cd $SRC/jxrlib
@@ -101,28 +101,31 @@ cd $SRC/aom
mkdir build.libavif
cd build.libavif
extra_libaom_flags='-DAOM_MAX_ALLOCABLE_MEMORY=536870912 -DDO_RANGE_CHECK_CLAMP=1'
cmake -G Ninja -DBUILD_SHARED_LIBS=0 -DENABLE_APPS=0 -DENABLE_DOCS=0 -DENABLE_EXAMPLES=0 -DENABLE_TESTDATA=0 -DENABLE_TESTS=0 -DENABLE_TOOLS=0 -DCONFIG_PIC=1 -DAOM_TARGET_CPU=generic -DCONFIG_SIZE_LIMIT=1 -DDECODE_HEIGHT_LIMIT=12288 -DDECODE_WIDTH_LIMIT=12288 -DAOM_EXTRA_C_FLAGS="${extra_libaom_flags}" -DAOM_EXTRA_CXX_FLAGS="${extra_libaom_flags}" ..
ninja install
cmake -DBUILD_SHARED_LIBS=0 -DENABLE_DOCS=0 -DENABLE_EXAMPLES=0 -DENABLE_TESTDATA=0 -DENABLE_TESTS=0 -DENABLE_TOOLS=0 -DCONFIG_PIC=1 -DAOM_TARGET_CPU=generic -DCONFIG_SIZE_LIMIT=1 -DDECODE_HEIGHT_LIMIT=12288 -DDECODE_WIDTH_LIMIT=12288 -DAOM_EXTRA_C_FLAGS="${extra_libaom_flags}" -DAOM_EXTRA_CXX_FLAGS="${extra_libaom_flags}" ..
make -j$(nproc)
make install -j$(nproc)
# Build libavif
cd $SRC/libavif
ln -s "$SRC/aom" "$SRC/libavif/ext/"
mkdir build
cd build
CFLAGS="$CFLAGS -fPIC" cmake -G Ninja -DBUILD_SHARED_LIBS=OFF -DAVIF_ENABLE_WERROR=OFF -DAVIF_CODEC_AOM=LOCAL -DAVIF_LIBYUV=OFF ..
ninja
CFLAGS="$CFLAGS -fPIC" cmake -DBUILD_SHARED_LIBS=OFF -DAVIF_ENABLE_WERROR=OFF -DAVIF_CODEC_AOM=LOCAL -DAVIF_LIBYUV=OFF ..
make -j$(nproc)
# Build libde265
cd $SRC/libde265
cmake -G Ninja -DBUILD_SHARED_LIBS=OFF -DENABLE_SDL=OFF -DENABLE_SIMD=OFF -DENABLE_AVX2=OFF -DENABLE_AVX512=OFF .
ninja install
cmake -DBUILD_SHARED_LIBS=OFF -DDISABLE_SSE=ON .
make -j$(nproc)
make install -j$(nproc)
# Build openjpeg
cd $SRC/openjpeg
mkdir build
cd build
cmake -G Ninja -DBUILD_SHARED_LIBS=OFF -DBUILD_STATIC_LIBS=ON -DBUILD_CODEC=OFF ..
ninja install
cmake -DBUILD_SHARED_LIBS=OFF -DBUILD_STATIC_LIBS=ON -DBUILD_CODEC=OFF ..
make -j$(nproc)
make install -j$(nproc)
# build openh264
cd $SRC/openh264
@@ -132,15 +135,9 @@ make USE_ASM=No BUILDTYPE=Debug install-static -j$(nproc)
cd $SRC/openexr
mkdir _build
cd _build
cmake -G Ninja -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF -DOPENEXR_BUILD_TOOLS=OFF -DOPENEXR_INSTALL_TOOLS=OFF -DOPENEXR_BUILD_EXAMPLES=OFF -DOPENEXR_TEST_LIBRARIES=OFF -DOPENEXR_TEST_TOOLS=OFF -DOPENEXR_TEST_PYTHON=OFF ..
ninja install
# Build libjxl
cd $SRC/libjxl
mkdir build
cd build
CXXFLAGS="$CXXFLAGS -DHWY_COMPILE_ONLY_SCALAR" cmake -G Ninja -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF -DJPEGXL_ENABLE_BENCHMARK=OFF -DJPEGXL_ENABLE_DOXYGEN=OFF -DJPEGXL_ENABLE_EXAMPLES=OFF -DJPEGXL_ENABLE_JNI=OFF -DJPEGXL_ENABLE_MANPAGES=OFF -DJPEGXL_ENABLE_OPENEXR=OFF -DJPEGXL_ENABLE_PLUGINS=OFF -DJPEGXL_ENABLE_SJPEG=OFF -DJPEGXL_ENABLE_SKCMS=ON -DJPEGXL_ENABLE_TCMALLOC=OFF -DJPEGXL_ENABLE_TOOLS=OFF -DJPEGXL_ENABLE_FUZZERS=OFF ..
ninja install
cmake -DBUILD_SHARED_LIBS=OFF ..
make -j$(nproc)
make install -j$(nproc)
# Build libheif
cd $SRC/libheif
@@ -149,50 +146,56 @@ sed -i "s/static const int MAX_IMAGE_WIDTH = 32768;/static const int MAX_IMAGE_W
sed -i "s/static const int MAX_IMAGE_HEIGHT = 32768;/static const int MAX_IMAGE_HEIGHT = 8192;/g" libheif/security_limits.h
mkdir build
cd build
cmake -G Ninja -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF -DENABLE_PLUGIN_LOADING=OFF -DWITH_EXAMPLES=OFF -DBUILD_DOCUMENTATION=OFF -DWITH_LIBSHARPYUV=OFF -DWITH_UNCOMPRESSED_CODEC=ON -DWITH_DAV1D=OFF -DWITH_EXAMPLES=OFF -DWITH_LIBDE265=ON -DWITH_RAV1E=OFF -DWITH_RAV1E_PLUGIN=OFF -DWITH_SvtEnc=OFF -DWITH_SvtEnc_PLUGIN=OFF -DWITH_X265=OFF -DWITH_X264=OFF -DWITH_OpenJPEG_DECODER=ON -DWITH_OpenH264_DECODER=ON ..
ninja install
cmake -DBUILD_SHARED_LIBS=OFF -DENABLE_PLUGIN_LOADING=OFF -DWITH_DAV1D=OFF -DWITH_EXAMPLES=OFF -DWITH_LIBDE265=ON -DWITH_RAV1E=OFF -DWITH_RAV1E_PLUGIN=OFF -DWITH_SvtEnc=OFF -DWITH_SvtEnc_PLUGIN=OFF -DWITH_X265=OFF -DWITH_OpenJPEG_DECODER=ON -DWITH_OpenH264_DECODER=ON ..
make -j$(nproc)
make install -j$(nproc)
# Build libjxl
cd $SRC/libjxl
mkdir build
cd build
CXXFLAGS="$CXXFLAGS -DHWY_COMPILE_ONLY_SCALAR" cmake -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF -DJPEGXL_ENABLE_BENCHMARK=OFF -DJPEGXL_ENABLE_DOXYGEN=OFF -DJPEGXL_ENABLE_EXAMPLES=OFF -DJPEGXL_ENABLE_JNI=OFF -DJPEGXL_ENABLE_JPEGLI=OFF -DJPEGXL_ENABLE_JPEGLI_LIBJPEG=OFF -DJPEGXL_ENABLE_MANPAGES=OFF -DJPEGXL_ENABLE_OPENEXR=OFF -DJPEGXL_ENABLE_PLUGINS=OFF -DJPEGXL_ENABLE_SJPEG=OFF -DJPEGXL_ENABLE_SKCMS=ON -DJPEGXL_ENABLE_TCMALLOC=OFF -DJPEGXL_ENABLE_TOOLS=OFF -DJPEGXL_ENABLE_FUZZERS=OFF ..
make -j$(nproc) jxl jxl_cms jxl_threads
cd $SRC/kimageformats
HANDLER_TYPES="ani
avif
dds
exr
ff
hdr
heif
iff
jp2
jxl
jxr
kra
pcx
pfm
pic
psd
pxr
qoi
ras
raw
rgb
sct
tim
tga
xcf"
HANDLER_TYPES="ANIHandler ani
QAVIFHandler avif
QDDSHandler dds
EXRHandler exr
FFHandler ff
HDRHandler hdr
HEIFHandler heif
IFFHandler iff
JP2Handler jp2
QJpegXLHandler jxl
JXRHandler jxr
KraHandler kra
OraHandler ora
PCXHandler pcx
PFMHandler pfm
SoftimagePICHandler pic
PSDHandler psd
PXRHandler pxr
QOIHandler qoi
RASHandler ras
RAWHandler raw
RGBHandler rgb
ScitexHandler sct
TIMHandler tim
TGAHandler tga
XCFHandler xcf"
echo "$HANDLER_TYPES" | while read format; do
echo "$HANDLER_TYPES" | while read class format; do
(
fuzz_target_name=kimgio_${format}_fuzzer
/usr/libexec/moc $SRC/kimageformats/src/imageformats/$format.cpp -o $format.moc
header=`ls $SRC/kimageformats/src/imageformats/$format*.h`
/usr/libexec/moc $header -o moc_`basename $header .h`.cpp
$CXX $CXXFLAGS $LDFLAGS -fPIC -DKIMG_FUZZER_${format}=1 -std=c++17 autotests/ossfuzz/kimgio_fuzzer.cc $SRC/kimageformats/src/imageformats/$format.cpp $SRC/kimageformats/src/imageformats/scanlineconverter.cpp $SRC/kimageformats/src/imageformats/photoshop.cpp $SRC/kimageformats/src/imageformats/microexif.cpp $SRC/kimageformats/src/imageformats/chunks.cpp -o $OUT/$fuzz_target_name -DJXL_STATIC_DEFINE -DJXL_THREADS_STATIC_DEFINE -DJXL_CMS_STATIC_DEFINE -D__ANSI__ -I $SRC/kimageformats/src/imageformats/ -I $SRC/libavif/include/ -I $SRC/libjxl/build/lib/include/ -I $SRC/libjxl/lib/include/ -I /usr/local/include/OpenEXR/ -I /usr/local/include/KF6/KArchive/ -I /usr/local/include/openjpeg-2.5 -I /usr/local/include/Imath -I $SRC/jxrlib/common/include -I $SRC/jxrlib/jxrgluelib -I $SRC/jxrlib/image/sys -I /usr/include/QtCore/ -I /usr/include/QtGui/ -I . $SRC/libavif/build/libavif.a /usr/local/lib/libheif.a /usr/local/lib/libde265.a /usr/local/lib/libopenh264.a $SRC/aom/build.libavif/libaom.a $SRC/libjxl/build/lib/libjxl_threads.a $SRC/libjxl/build/lib/libjxl.a $SRC/libjxl/build/lib/libjxl_cms.a $SRC/libjxl/build/third_party/highway/libhwy.a $SRC/libjxl/build/third_party/brotli/libbrotlidec.a $SRC/libjxl/build/third_party/brotli/libbrotlienc.a $SRC/libjxl/build/third_party/brotli/libbrotlicommon.a -lQt6Gui -lQt6Core -lQt6BundledLibpng -lQt6BundledHarfbuzz -lm -lQt6BundledPcre2 -ldl -lpthread $LIB_FUZZING_ENGINE /usr/local/lib/libz.a /usr/local/lib/x86_64-linux-gnu/libKF6Archive.a /usr/local/lib/libz.a /usr/local/lib/libraw.a /usr/local/lib/libOpenEXR-3_4.a /usr/local/lib/libIex-3_4.a /usr/local/lib/libImath-3_2.a /usr/local/lib/libIlmThread-3_4.a /usr/local/lib/libOpenEXRCore-3_4.a /usr/local/lib/libOpenEXRUtil-3_4.a /usr/local/lib/libopenjp2.a /usr/local/lib/libzstd.a $SRC/jxrlib/build/libjxrglue.a $SRC/jxrlib/build/libjpegxr.a /usr/local/lib/liblzma.a /usr/local/lib/libbz2.a -lclang_rt.builtins
$CXX $CXXFLAGS $LDFLAGS -fPIC -DHANDLER=$class -std=c++17 autotests/ossfuzz/kimgio_fuzzer.cc $SRC/kimageformats/src/imageformats/$format.cpp $SRC/kimageformats/src/imageformats/scanlineconverter.cpp $SRC/kimageformats/src/imageformats/microexif.cpp $SRC/kimageformats/src/imageformats/chunks.cpp -o $OUT/$fuzz_target_name -DJXL_STATIC_DEFINE -DJXL_THREADS_STATIC_DEFINE -DJXL_CMS_STATIC_DEFINE -D__ANSI__ -I $SRC/kimageformats/src/imageformats/ -I $SRC/libavif/include/ -I $SRC/libjxl/build/lib/include/ -I $SRC/libjxl/lib/include/ -I /usr/local/include/OpenEXR/ -I /usr/local/include/KF6/KArchive/ -I /usr/local/include/openjpeg-2.5 -I /usr/local/include/Imath -I $SRC/jxrlib/common/include -I $SRC/jxrlib/jxrgluelib -I $SRC/jxrlib/image/sys -I /usr/include/QtCore/ -I /usr/include/QtGui/ -I . $SRC/libavif/build/libavif.a /usr/local/lib/libheif.a /usr/local/lib/libde265.a /usr/local/lib/libopenh264.a $SRC/aom/build.libavif/libaom.a $SRC/libjxl/build/lib/libjxl_threads.a $SRC/libjxl/build/lib/libjxl.a $SRC/libjxl/build/lib/libjxl_cms.a $SRC/libjxl/build/third_party/highway/libhwy.a $SRC/libjxl/build/third_party/brotli/libbrotlidec.a $SRC/libjxl/build/third_party/brotli/libbrotlienc.a $SRC/libjxl/build/third_party/brotli/libbrotlicommon.a -lQt6Gui -lQt6Core -lQt6BundledLibpng -lQt6BundledHarfbuzz -lm -lQt6BundledPcre2 -ldl -lpthread $LIB_FUZZING_ENGINE /usr/local/lib/libz.a /usr/local/lib/x86_64-linux-gnu/libKF6Archive.a /usr/local/lib/libz.a /usr/local/lib/libraw.a /usr/local/lib/libOpenEXR-3_3.a /usr/local/lib/libIex-3_3.a /usr/local/lib/libImath-3_1.a /usr/local/lib/libIlmThread-3_3.a /usr/local/lib/libOpenEXRCore-3_3.a /usr/local/lib/libOpenEXRUtil-3_3.a /usr/local/lib/libopenjp2.a /usr/local/lib/libzstd.a $SRC/jxrlib/build/libjxrglue.a $SRC/jxrlib/build/libjpegxr.a /usr/local/lib/liblzma.a /usr/local/lib/libbz2.a -lclang_rt.builtins
# -lclang_rt.builtins in the previous line is a temporary workaround to avoid a linker error "undefined reference to __truncsfhf2". Investigate why this is needed here, but not anywhere else, and possibly remove it.
find . -name "*.${format}" | zip -q $OUT/${fuzz_target_name}_seed_corpus.zip -@
)
done
# Manually add other supported extensions to HEIF seed corpus
find . -type f \( -name "*.avci" -o -name "*.heic" -o -name "*.hej2" \) | zip -q $OUT/kimgio_heif_fuzzer_seed_corpus.zip -@
+5 -77
View File
@@ -23,7 +23,7 @@
Usage:
python infra/helper.py build_image kimageformats
python infra/helper.py build_fuzzers --sanitizer undefined|address|memory kimageformats
python infra/helper.py run_fuzzer kimageformats kimgio_[ani|avif|dds|exr|ff|hdr|heif|iff|jp2|jxl|jxr|kra|pcx|pfm|pic|psd|pxr|qoi|ras|raw|rgb|sct|tim|tga|xcf]_fuzzer
python infra/helper.py run_fuzzer kimageformats kimgio_[ani|avif|dds|exr|ff|hdr|heif|iff|jp2|jxl|jxr|kra|ora|pcx|pfm|pic|psd|pxr|qoi|ras|raw|rgb|sct|tim|tga|xcf]_fuzzer
*/
#include <QBuffer>
@@ -31,84 +31,32 @@
#include <QImage>
#include <QImageReader>
#if defined KIMG_FUZZER_ani
#include "ani_p.h"
#define HANDLER ANIHandler
#elif defined KIMG_FUZZER_avif
#include "avif_p.h"
#define HANDLER QAVIFHandler
#elif defined KIMG_FUZZER_dds
#include "dds_p.h"
#define HANDLER QDDSHandler
#elif defined KIMG_FUZZER_exr
#include "exr_p.h"
#define HANDLER EXRHandler
#elif defined KIMG_FUZZER_ff
#include "ff_p.h"
#define HANDLER FFHandler
#elif defined KIMG_FUZZER_hdr
#include "hdr_p.h"
#define HANDLER HDRHandler
#elif defined KIMG_FUZZER_heif
#include "heif_p.h"
#define HANDLER HEIFHandler
#elif defined KIMG_FUZZER_iff
#include "iff_p.h"
#define HANDLER IFFHandler
#elif defined KIMG_FUZZER_jp2
#include "jp2_p.h"
#define HANDLER JP2Handler
#elif defined KIMG_FUZZER_jxl
#include "jxl_p.h"
#define HANDLER QJpegXLHandler
#elif defined KIMG_FUZZER_jxr
#include "jxr_p.h"
#define HANDLER JXRHandler
#elif defined KIMG_FUZZER_kra
#include "kra_p.h"
#define HANDLER KraHandler
#elif defined KIMG_FUZZER_pcx
#include "kra.h"
#include "ora.h"
#include "pcx_p.h"
#define HANDLER PCXHandler
#elif defined KIMG_FUZZER_pfm
#include "pfm_p.h"
#define HANDLER PFMHandler
#elif defined KIMG_FUZZER_pic
#include "pic_p.h"
#define HANDLER SoftimagePICHandler
#elif defined KIMG_FUZZER_psd
#include "psd_p.h"
#define HANDLER PSDHandler
#elif defined KIMG_FUZZER_pxr
#include "pxr_p.h"
#define HANDLER PXRHandler
#elif defined KIMG_FUZZER_qoi
#include "qoi_p.h"
#define HANDLER QOIHandler
#elif defined KIMG_FUZZER_ras
#include "ras_p.h"
#define HANDLER RASHandler
#elif defined KIMG_FUZZER_raw
#include "raw_p.h"
#define HANDLER RAWHandler
#elif defined KIMG_FUZZER_rgb
#include "rgb_p.h"
#define HANDLER RGBHandler
#elif defined KIMG_FUZZER_sct
#include "sct_p.h"
#define HANDLER ScitexHandler
#elif defined KIMG_FUZZER_tim
#include "tim_p.h"
#define HANDLER TIMHandler
#elif defined KIMG_FUZZER_tga
#include "tga_p.h"
#define HANDLER TGAHandler
#elif defined KIMG_FUZZER_xcf
#include "xcf_p.h"
#define HANDLER XCFHandler
#else
#error "KIMG_FUZZER_format not defined!"
#endif
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
@@ -117,7 +65,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
QImageReader::setAllocationLimit(512);
QImageIOHandler *handler = new HANDLER();
QImageIOHandler* handler = new HANDLER();
QImage i;
QBuffer b;
@@ -125,27 +73,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
b.open(QIODevice::ReadOnly);
handler->setDevice(&b);
handler->canRead();
bool is_animated = false;
if (handler->supportsOption(QImageIOHandler::Animation)) {
is_animated = handler->option(QImageIOHandler::Animation).toBool();
}
if (is_animated) { // animated image
if (handler->supportsOption(QImageIOHandler::Size)) {
handler->option(QImageIOHandler::Size).toSize();
}
handler->imageCount();
handler->loopCount();
handler->read(&i);
handler->nextImageDelay();
handler->currentImageNumber();
handler->jumpToImage(0);
handler->jumpToNextImage();
} else { // static image
handler->read(&i);
}
handler->read(&i);
delete handler;
+3 -3
View File
@@ -27,13 +27,13 @@ apt-get update && \
git clone --depth 1 https://github.com/madler/zlib.git
git clone --depth 1 -b v1.5.7 https://github.com/facebook/zstd.git
wget https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz
git clone --depth 1 https://github.com/tukaani-project/xz.git
git clone --depth 1 --branch=RB-3.4 https://github.com/AcademySoftwareFoundation/openexr.git
git clone https://github.com/tukaani-project/xz.git
git clone --depth 1 --branch=RB-3.3 https://github.com/AcademySoftwareFoundation/openexr.git
git clone --depth 1 -b master https://invent.kde.org/frameworks/extra-cmake-modules.git
git clone --depth 1 --branch=dev git://code.qt.io/qt/qtbase.git
git clone --depth 1 --branch=dev git://code.qt.io/qt/qttools.git
git clone --depth 1 -b master https://invent.kde.org/frameworks/karchive.git
git clone --depth 1 -b v3.15.0 https://aomedia.googlesource.com/aom
git clone --depth 1 -b v3.14.1 https://aomedia.googlesource.com/aom
git clone --depth 1 -b v1.4.2 https://github.com/AOMediaCodec/libavif.git
git clone --depth 1 https://github.com/strukturag/libde265.git
git clone --depth 1 -b v2.5.4 https://github.com/uclouvain/openjpeg.git
Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 255 KiB

-7
View File
@@ -1,7 +0,0 @@
[
{
"fileName": "grid.png",
"fuzziness": 2,
"description": "Minimum fuzziness value to pass the test on all architectures."
}
]
Binary file not shown.

Before

Width:  |  Height:  |  Size: 277 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 KiB

@@ -1,7 +0,0 @@
[
{
"fileName": "invalid-exif.jpg",
"fuzziness": 30,
"description": "Minimum fuzziness value to pass the test on all architectures."
}
]
Binary file not shown.

Before

Width:  |  Height:  |  Size: 366 KiB

Binary file not shown.
@@ -1,33 +0,0 @@
[
{
"fileName" : "alphatest_rgba.tif",
"colorSpace" : {
"description" : "sRGB build-in (Profilo RGB lineare)",
"primaries" : "SRgb",
"transferFunction" : "Linear",
"gamma" : 1
},
"metadata" : [
{
"key" : "ModificationDate",
"value" : "2026-09-04T11:45:06"
},
{
"key" : "Software" ,
"value" : "Adobe Photoshop 27.10 (Windows)"
},
{
"key" : "Author",
"value" : "Mirco Miranda"
},
{
"key" : "Description",
"value" : "This test is designed to detect problems with alpha encoding. Specifically, it detects incorrect use of associated values (premultiplied alpha) and unassociated values (normal alpha)."
}
],
"resolution" : {
"dotsPerMeterX" : 11811,
"dotsPerMeterY" : 11811
}
}
]
Binary file not shown.
@@ -7,19 +7,9 @@
"transferFunction" : "Linear",
"gamma" : 1
},
"metadata" : [
{
"key" : "ModificationDate",
"value" : "2026-04-15T10:48:48"
},
{
"key" : "Software" ,
"value" : "Adobe Photoshop 27.5 (Windows)"
}
],
"resolution" : {
"dotsPerMeterX" : 11811,
"dotsPerMeterY" : 11811
"dotsPerMeterX" : 3937,
"dotsPerMeterY" : 3937
}
}
]
Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 199 B

Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 242 B

Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 234 B

Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 232 B

Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 221 B

Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 222 B

Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 243 B

Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 B

Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 244 B

Binary file not shown.
-7
View File
@@ -1,7 +0,0 @@
[
{
"fileName": "konqi.jpg",
"fuzziness": 72,
"description": "Minimum fuzziness value to pass the test on all architectures."
}
]
Binary file not shown.

Before

Width:  |  Height:  |  Size: 362 KiB

Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.
-7
View File
@@ -1,7 +0,0 @@
[
{
"fileName" : "jpeg.png",
"fuzziness" : 1,
"description" : "Minimum fuzziness value to pass the test on all architectures."
}
]
Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.
@@ -1,5 +0,0 @@
[
{
"fileName" : "sv5_idx8_rgx.png"
}
]
Binary file not shown.
@@ -1,5 +0,0 @@
[
{
"fileName" : "sv5_rgb16_rgx.png"
}
]
Binary file not shown.
@@ -1,5 +0,0 @@
[
{
"fileName" : "sv5_rgb32_rgx.png"
}
]
Binary file not shown.
@@ -1,5 +0,0 @@
[
{
"fileName" : "sv5_rgb8_rgx.png"
}
]

Some files were not shown because too many files have changed in this diff Show More