[AD] [ alleg-Bugs-1842602 ] load_txt_font crashes

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Bugs item #1842602, was opened at 2007-12-02 11:51
Message generated for change (Settings changed) made by mmimica
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105665&aid=1842602&group_id=5665

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
>Resolution: Accepted
Priority: 5
Private: No
Submitted By: Christer Sandberg (chrisan)
Assigned to: Nobody/Anonymous (nobody)
Summary: load_txt_font crashes

Initial Comment:
When omitting the end of the glyph interval in the text file load_txt_font causes a segmentation fault. Content of font.txt:
prop_font_orig.bmp 0x20

Code:
#include <allegro.h>
int main(void)
{
   FONT *f;
   if (allegro_init() != 0) return 1;
   if (set_gfx_mode(GFX_AUTODETECT_WINDOWED, 320, 200, 0, 0) != 0) return 1;
   f = load_txt_font("font.txt", NULL , NULL);
   return 0;
}
END_OF_MAIN()

Adding the end code 0xff in font.txt makes it load correctly and it also draws the glyphs in the entire interval correctly

Allegro 4.2.2
Ubuntu 7.04


----------------------------------------------------------------------

Comment By: Milan Mimica (mmimica)
Date: 2008-01-22 20:00

Message:
Logged In: YES 
user_id=1171214
Originator: NO

Thanks! Committed the patch to 4.3.10+ branch on SVN.

----------------------------------------------------------------------

Comment By: Christer Sandberg (chrisan)
Date: 2007-12-06 21:47

Message:
Logged In: YES 
user_id=713645
Originator: YES

Attached patch should fixes the crash, and also fixes that leaving out the
end glyph crashes. Also fixes another missing check for NULL in the same
loop, and replaces an _AL_FREE with destroy_font(), as well as adjusting
bad indentation.
File Added: fonttxt.diff

----------------------------------------------------------------------

Comment By: Elias Pschernig (elias)
Date: 2007-12-06 20:55

Message:
Logged In: YES 
user_id=32894
Originator: NO

Ah, I see. So to fix it, it should just use as many characters as it can
find after the given one.

----------------------------------------------------------------------

Comment By: Christer Sandberg (chrisan)
Date: 2007-12-06 20:30

Message:
Logged In: YES 
user_id=713645
Originator: YES

Strange. So what does 
"the script:
...
dingbats.fnt 0x1000
would import ... the entire contents of dingbats.fnt starting at Unicode
position 0x1000."
mean if it does not mean that you can omit the end glyph if you want to
load the entire contents?

----------------------------------------------------------------------

Comment By: Elias Pschernig (elias)
Date: 2007-12-06 18:01

Message:
Logged In: YES 
user_id=32894
Originator: NO

According to
http://www.liballeg.org/stabledocs/en//alleg017.html#load_txt_font you
can't leave out the end glyph.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105665&aid=1842602&group_id=5665




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/