I noticed that if you call
TTF_Font * TTF_OpenFont(const char *file, int ptsize);
with an inexisting “file” pathname, then SDL_ttf simply crashes.
Here is the gdb output:
Program received signal SIGSEGV, Segmentation fault.
0x0804ac6b in TTF_OpenFontIndexRW (src=0x0, freesrc=1, ptsize=16, index=0) at
SDL_ttf.c:244
244 position = SDL_RWtell(src);
I found there there where no check that for file existance, then here is the patch.
Yeah, that sounds like a pretty nasty bug, and very un-SDL like. I
hope Sam applies the patch.On Mon, 19 Jul 2004 15:55:15 +0200, Nuage wrote:
Hello,
I noticed that if you call
TTF_Font * TTF_OpenFont(const char *file, int ptsize);
with an inexisting “file” pathname, then SDL_ttf simply crashes.
Here is the gdb output:
Program received signal SIGSEGV, Segmentation fault.
0x0804ac6b in TTF_OpenFontIndexRW (src=0x0, freesrc=1, ptsize=16, index=0) at
SDL_ttf.c:244
244 position = SDL_RWtell(src);
I found there there where no check that for file existance, then here is the patch.
Can someone patch it official SDL_ttf ?
Luc-Olivier
–
Patrick “Diablo-D3” McFarland || @Patrick_McFarland
"Computer games don’t affect kids; I mean if Pac-Man affected us as kids, we’d
all be running around in darkened rooms, munching magic pills and listening to
repetitive electronic music." – Kristian Wilson, Nintendo, Inc, 1989
This is not bug, it is feature.
The NULL is not a filename and as you can read from http://jcatki.no-ip.org/SDL_ttf/ (when the site is not down)
“NOTE: src is not checked for NULL, so be careful.”
I noticed that if you call
TTF_Font * TTF_OpenFont(const char *file, int ptsize);
with an inexisting “file” pathname, then SDL_ttf simply crashes.
This is not bug, it is feature.
The NULL is not a filename and as you can read from http://jcatki.no-ip.org/SDL_ttf/ (when the site is not down)
“NOTE: src is not checked for NULL, so be careful.”
He didn’t pass NULL to TTF_OpenFont. He passed it a valid filename;
TTF_OpenFontIndexRW received NULL.On Fri, Jul 23, 2004 at 02:20:22AM +0200, Ivo Danihelka wrote:
0x0804ac6b in TTF_OpenFontIndexRW (src=0x0, freesrc=1, ptsize=16, index=0)
Ivo Danihelka wrote:
| On Mon, 2004-07-19 at 15:55, Nuage wrote:
|
|>Hello,
|>
|>I noticed that if you call
|>TTF_Font * TTF_OpenFont(const char *file, int ptsize);
|>with an inexisting “file” pathname, then SDL_ttf simply crashes.
|>
|
|
| This is not bug, it is feature.
(Can’t call a missing check a feature, but it’s not the point.)
It’s written:
"
NOTE: src is not checked for NULL, so be careful.
Returns: a pointer to the font as a TTF_Font. NULL is returned on errors.
"
And when I send a valid filename of an inexisting file, it crash,
instead of returning NULL as specified.
Thanks for the google link…
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org