Fix wrong step size in wxImage::Paste()

Fix a bug with wrong size passed to memset() introduced in 1f0ade29f0
(Fix using mask colour even if there is no mask in wxImage::Paste,
2020-09-30) which caused memory corruption and add a test (the one with
the large negative vertical offset) allowing to reproduce this reliably.

Closes https://github.com/wxWidgets/wxWidgets/pull/2067
This commit is contained in:
Eric Raijmakers
2020-10-01 19:27:28 +02:00
committed by Vadim Zeitlin
parent 0c3494592a
commit ec8bfbebdc
2 changed files with 16 additions and 1 deletions

View File

@@ -1764,7 +1764,7 @@ wxImage::Paste(const wxImage & image, int x, int y,
// Make all the copied pixels fully opaque
if (alpha_target_data != NULL)
{
memset(alpha_target_data, wxALPHA_OPAQUE, target_alpha_step);
memset(alpha_target_data, wxALPHA_OPAQUE, width);
alpha_target_data += target_alpha_step;
}
}