Bug#405154: libsdl-gfx1.2-4: unchecked surface allocation results in segfault

Kevin Locke kwl7 at cornell.edu
Mon Jan 1 02:12:41 CET 2007


Package: libsdl-gfx1.2-4
Version: 2.0.13-2+b1
Severity: normal
Tags: patch

In SDL_rotozoom.c there are several calls to SDL_CreateRGBSurface()
where the return value is passed unchecked to subsequent functions
where it is dereferenced (such as zoomSurfaceRGBA()) which results in
segfaults.  The attached patch bails out and returns NULL if
allocation fails (since SDL_Error is already set by CreateSurface()
upon failure).

There may be more elegant ways to handle this (is there a way to
recover from failed allocations?) but at least this will allow the
user to call SDL_GetError() on failure.

Hope you find it useful,
Kevin

-- System Information:
Debian Release: 4.0
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/dash
Kernel: Linux 2.6.18.20061209a
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

Versions of packages libsdl-gfx1.2-4 depends on:
ii  libc6                        2.3.6.ds1-8 GNU C Library: Shared libraries
ii  libsdl1.2debian              1.2.11-7    Simple DirectMedia Layer

libsdl-gfx1.2-4 recommends no packages.

-- no debconf information
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libsdl-gfx1.2-rotozoom_allocation_checks.patch
Type: text/x-c
Size: 1850 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/pkg-sdl-maintainers/attachments/20070101/9817b843/libsdl-gfx1.2-rotozoom_allocation_checks.bin


More information about the Pkg-sdl-maintainers mailing list