JUCE
JUCE copied to clipboard
[Bug]: (Juce 8) Crash if loaded image is larger than maximum bitmap size
Detailed steps on how to reproduce the bug
Attempt to load a png with either width or height being larger than the maximum bitmap size as reported by deviceContext->GetMaximumBitmapSize()
What is the expected behaviour?
The image should fail to load and the loader should handle that gracefully in any meaningful way
The problem seems to be in juce_Direct2DImage_windows.cpp line 170. The creation of nativeBitmap at line 168 fails but this is not checked so SoftwareDataReleaser::flushImage is called even though nativeBitmap is nullptr
Operating systems
Windows
What versions of the operating systems?
Windows 11, GTX 4070, maximum bitmap size reported as being 16384
Architectures
x86_64
Stacktrace
> OsTIrus.dll!juce::SoftwareDataReleaser::flushImage(juce::Image softwareImage, juce::ComSmartPtr<ID2D1Bitmap1> native, D2D_RECT_U target) Line 115 C++
OsTIrus.dll!juce::Direct2DPixelData::createDeviceResources() Line 173 C++
OsTIrus.dll!juce::Direct2DPixelData::getAdapterD2D1Bitmap() Line 468 C++
OsTIrus.dll!juce::Direct2DPixelData::initialiseBitmapData(juce::Image::BitmapData & bitmap, int x, int y, juce::Image::BitmapData::ReadWriteMode mode) Line 276 C++
OsTIrus.dll!juce::Image::BitmapData::BitmapData(const juce::Image & im, juce::Image::BitmapData::ReadWriteMode mode) Line 456 C++
OsTIrus.dll!juce::PNGHelpers::createImageFromData(bool hasAlphaChan, int width, int height, unsigned char * * rows) Line 439 C++
OsTIrus.dll!juce::PNGHelpers::readImage(juce::InputStream & in, juce::pnglibNamespace::png_struct_def * pngReadStruct, juce::pnglibNamespace::png_info_def * pngInfoStruct) Line 493 C++
OsTIrus.dll!juce::PNGHelpers::readImage(juce::InputStream & in) Line 506 C++
OsTIrus.dll!juce::PNGImageFormat::decodeImage(juce::InputStream & in) Line 546 C++
OsTIrus.dll!juce::ImageFileFormat::loadFrom(juce::InputStream & input) Line 91 C++
OsTIrus.dll!juce::ImageFileFormat::loadFrom(const void * rawData, unsigned __int64 numBytes) Line 114 C++
Plug-in formats (if applicable)
No response
Plug-in host applications (DAWs) (if applicable)
No response
Testing on the develop branch
I have not tested against the develop branch
Code of Conduct
- [X] I agree to follow the Code of Conduct