[PATCH] Memory corruption problems in SDL_ttf

Hello,

We noticed that, when using italic fonts, SDL_ttf causes memory to be
corrupt. It looks like freetype renders pixmaps which are larger than
advertised (that is, glyph->pixmap.width > glyph->maxx - glyph->minx).
This causes rendering to overflow out of the drawing box, thus
corrupting memory.

The attached patch fixes that. It also fixes textbox width calculations,
taking kerning into account, and adds a generic overflow detection, to
prevent any memory corruption error that may occur.

Regards,

Philippe Plantier / Ayin
Battle for Wesnoth - www.wesnoth.org
-------------- next part --------------
A non-text attachment was scrubbed…
Name: sdl_ttf_memcorrupt.diff
Type: text/x-patch
Size: 2413 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20041030/c676a514/attachment.bin

Hello,

We noticed that, when using italic fonts, SDL_ttf causes memory to be
corrupt. It looks like freetype renders pixmaps which are larger than
advertised (that is, glyph->pixmap.width > glyph->maxx - glyph->minx).
This causes rendering to overflow out of the drawing box, thus
corrupting memory.

The attached patch fixes that. It also fixes textbox width calculations,
taking kerning into account, and adds a generic overflow detection, to
prevent any memory corruption error that may occur.

Thanks! This patch is in CVS.

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment