Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: (Juce 8) Crash if loaded image is larger than maximum bitmap size #1388

Open
1 task done
dsp56300 opened this issue Jun 6, 2024 · 0 comments
Open
1 task done

Comments

@dsp56300
Copy link

dsp56300 commented Jun 6, 2024

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

  • I agree to follow the Code of Conduct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant