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:
@@ -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();
|
||||
|
Reference in New Issue
Block a user