Check for memory allocation failure in all wxImage::ResampleXXX()

This was previously done in ResampleNearest() but not in all the other
variants, so add the checks there too to avoid crashing when trying to
use too big image sizes.

Closes #19119.
This commit is contained in:
Vadim Zeitlin
2021-03-25 14:03:06 +01:00
parent 024d1543f1
commit 0959cdb4e0

View File

@@ -635,6 +635,8 @@ wxImage wxImage::ResampleBox(int width, int height) const
unsigned char* dst_data = ret_image.GetData();
unsigned char* dst_alpha = NULL;
wxCHECK_MSG( dst_data, ret_image, wxS("unable to create image") );
if ( src_alpha )
{
ret_image.SetAlpha();
@@ -782,6 +784,8 @@ wxImage wxImage::ResampleBilinear(int width, int height) const
unsigned char* dst_data = ret_image.GetData();
unsigned char* dst_alpha = NULL;
wxCHECK_MSG( dst_data, ret_image, wxS("unable to create image") );
if ( src_alpha )
{
ret_image.SetAlpha();
@@ -961,6 +965,8 @@ wxImage wxImage::ResampleBicubic(int width, int height) const
unsigned char* dst_data = ret_image.GetData();
unsigned char* dst_alpha = NULL;
wxCHECK_MSG( dst_data, ret_image, wxS("unable to create image") );
if ( src_alpha )
{
ret_image.SetAlpha();