Don't try to clear memory if the bitmap has an invalid size.

This commit is contained in:
Jeff Young 2020-01-12 21:30:30 +00:00
parent d24bd5c832
commit 9e8a66a0a3
3 changed files with 23 additions and 16 deletions

View File

@ -176,21 +176,26 @@ void DIALOG_FIND::onClose( wxCommandEvent& aEvent )
}
DIALOG_FIND_BASE::DIALOG_FIND_BASE( wxWindow* parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos,
const wxSize& size,
long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
DIALOG_FIND_BASE::DIALOG_FIND_BASE( wxWindow* parent, wxWindowID id, const wxString& title,
const wxPoint& pos, const wxSize& size, long style ) :
DIALOG_SHIM( parent, id, title, pos, size, style )
{
// these members are initialized only to avoid warnings about non initialized vars
/*
m_staticText1 = nullptr;
m_SearchCombo = nullptr;
m_button1 = nullptr;
m_button2 = nullptr;
m_button3 = nullptr;
*/
searchStringLabel = nullptr;
m_searchCombo = nullptr;
m_matchCase = nullptr;
m_matchWords = nullptr;
m_wildcards = nullptr;
m_wrap = nullptr;
m_includeValues = nullptr;
m_includeReferences = nullptr;
m_includeTexts = nullptr;
m_includeMarkers = nullptr;
m_includeVias = nullptr;
m_findNext = nullptr;
m_findPrevious = nullptr;
m_searchAgain = nullptr;
m_closeButton = nullptr;
}

View File

@ -161,7 +161,8 @@ static inline void bm_clear( potrace_bitmap_t* bm, int c )
* guaranteed that size will fit into the ptrdiff_t type. */
ptrdiff_t size = bm_size( bm );
memset( bm_base( bm ), c ? -1 : 0, size );
if( size > 0 )
memset( bm_base( bm ), c ? -1 : 0, size );
}

View File

@ -159,7 +159,8 @@ void gm_clear( greymap_t* gm, int b )
if( b == 0 )
{
memset( gm->base, 0, size );
if( size > 0 )
memset( gm->base, 0, size );
}
else
{
@ -176,7 +177,7 @@ void gm_clear( greymap_t* gm, int b )
/* turn the given greymap upside down. This does not move the pixel
* data or change the base address. */
static inline void gm_flip( greymap_t* gm )
static inline void GM_FLIP( greymap_t* gm )
{
int dy = gm->dy;