Refuse to create palettes with more than 256 colours.

Creating palettes with more than USHRT_MAX could result in memory corruption
and there is really no reason to allow more than 256 of them anyhow as we
already check that the color index is in 0..255 range in GetRGB().

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@67071 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-02-27 13:10:43 +00:00
parent fbaae26c41
commit 2a35360c3d

View File

@@ -79,6 +79,9 @@ int wxPalette::GetColoursCount() const
bool wxPalette::Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue)
{
if ( n < 0 || n > 255 )
return false;
UnRef();
#if defined(__WXMICROWIN__)