sdl: Fix heap smash in sdl_zoom_rgb{16,32} for int > 32 bits

Careless use of malloc(): allocate Uint32[N], assign to int *, use
int[N].

Fix by converting to g_new().

Functions can't fail anymore, so make them return void.  Caller
ignored the value anyway.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
Markus Armbruster 2013-01-15 15:42:32 +01:00 committed by Anthony Liguori
parent dabe3143e0
commit cc69bda6c9
2 changed files with 10 additions and 15 deletions

View file

@ -13,13 +13,14 @@
#include "sdl_zoom.h"
#include "qemu/osdep.h"
#include <glib.h>
#include <stdint.h>
#include <stdio.h>
static int sdl_zoom_rgb16(SDL_Surface *src, SDL_Surface *dst, int smooth,
SDL_Rect *dst_rect);
static int sdl_zoom_rgb32(SDL_Surface *src, SDL_Surface *dst, int smooth,
SDL_Rect *dst_rect);
static void sdl_zoom_rgb16(SDL_Surface *src, SDL_Surface *dst, int smooth,
SDL_Rect *dst_rect);
static void sdl_zoom_rgb32(SDL_Surface *src, SDL_Surface *dst, int smooth,
SDL_Rect *dst_rect);
#define BPP 32
#include "sdl_zoom_template.h"