Possible fix for Mac library issue.
Fix off by one error in size. Git-bisect indicated a problem (on Mac only) caused by a change in an image file. It's possible that this is an error in code that we have 'got away with' until now. We always have an extra zero on the end of the image data and included it in the count of the size of stream to unpack. For a particular image this may have triggered a memory corruption problem.
This commit is contained in:
parent
07ea0ae03f
commit
6513fcf2ca
|
@ -985,7 +985,9 @@ bool ThemeBase::ReadImageCache( teThemeType type, bool bOkIfNotFound)
|
|||
pImage = HiContrastImageCacheAsData;
|
||||
break;
|
||||
}
|
||||
|
||||
// The image size includes a rogue '0' on the end, because the array ends in a ','.
|
||||
ImageSize--;
|
||||
//wxLogDebug("Reading ImageCache %p size %i", pImage, ImageSize );
|
||||
wxMemoryInputStream InternalStream( pImage, ImageSize );
|
||||
|
||||
if( !ImageCache.LoadFile( InternalStream, wxBITMAP_TYPE_PNG ))
|
||||
|
@ -997,6 +999,7 @@ bool ThemeBase::ReadImageCache( teThemeType type, bool bOkIfNotFound)
|
|||
wxMessageBox(_("Audacity could not read its default theme.\nPlease report the problem."));
|
||||
return false;
|
||||
}
|
||||
//wxLogDebug("Read %i by %i", ImageCache.GetWidth(), ImageCache.GetHeight() );
|
||||
}
|
||||
|
||||
// Resize a large image down.
|
||||
|
|
Loading…
Reference in New Issue