(svn r26103) -Fix: prevent odd overflows due to integer promotion

This commit is contained in:
rubidium 2013-11-25 13:06:33 +00:00
parent f018a1adc2
commit c5727f49d9
2 changed files with 2 additions and 2 deletions

View File

@ -95,7 +95,7 @@ void Blitter_32bppSimple::DrawColourMappingRect(void *dst, int width, int height
Sprite *Blitter_32bppSimple::Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator)
{
Blitter_32bppSimple::Pixel *dst;
Sprite *dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite) + sprite->height * sprite->width * sizeof(*dst));
Sprite *dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite) + (size_t)sprite->height * (size_t)sprite->width * sizeof(*dst));
dest_sprite->height = sprite->height;
dest_sprite->width = sprite->width;

View File

@ -58,7 +58,7 @@ void Blitter_8bppSimple::Draw(Blitter::BlitterParams *bp, BlitterMode mode, Zoom
Sprite *Blitter_8bppSimple::Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator)
{
Sprite *dest_sprite;
dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite) + sprite->height * sprite->width);
dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite) + (size_t)sprite->height * (size_t)sprite->width);
dest_sprite->height = sprite->height;
dest_sprite->width = sprite->width;