]> git.saurik.com Git - wxWidgets.git/commitdiff
Verify the validity of the buffer size in wxBufferedDC.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 1 May 2011 15:47:46 +0000 (15:47 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 1 May 2011 15:47:46 +0000 (15:47 +0000)
Passing invalid (e.g. negative) buffer size to wxBufferedDC resulted in many
problems later on so refuse it immediately.

Closes #13175.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67659 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/dcbufcmn.cpp

index 2e3d79240096cad1da4fe03a8316cd8cff5ac7c4..2a8314d43e3a5495d803e03479fac09595b2b4e0 100644 (file)
@@ -105,6 +105,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxSharedDCBufferManager, wxModule)
 
 void wxBufferedDC::UseBuffer(wxCoord w, wxCoord h)
 {
+    wxCHECK_RET( w >= -1 && h >= -1, "Invalid buffer size" );
+
     if ( !m_buffer || !m_buffer->IsOk() )
     {
         if ( w == -1 || h == -1 )