Bug 20569

Summary: libvgl tries to free global array
Product: Base System Reporter: Andrew Stevenson <andrew>
Component: binAssignee: Søren Schmidt <sos>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.0-STABLE   
Hardware: Any   
OS: Any   

Description Andrew Stevenson 2000-08-13 04:10:00 UTC
I have a program trying to use libvgl. When VGLInit is called it calls
VGLTextSetFontFile((byte *)0). This causes VGLTextFont to point to some
allocated memory and VGLTextFont->BitmapArray to point to VGLFont which is a
global array defined in text.c.

Later, when my program calls VGLTextSetFontFile VGLTextSetFontFile tries to
free this array causing "free(): warning: junk pointer, too high to make sense"

Also there are a few style(9) things...specifically the use of (type *)0 rather
than NULL.

Fix: 

I guess a flag needs to be set to indicate if the builtin font is being used
or a user set font. There may be a better way.
How-To-Repeat: 
if (VGLInit(VIDEO_MODE) != 0) {
        err(EX_UNAVAILABLE, "failed to initialise video display");
}

if (VGLTextSetFontFile(FONT) != 0) {
	reset_and_err(EX_UNAVAILABLE, "failed to load font (%s)", FONT);
}
Comment 1 Sheldon Hearn freebsd_committer freebsd_triage 2000-08-14 11:32:15 UTC
Responsible Changed
From-To: freebsd-bugs->sos

Over to the maintainer.
Comment 2 Søren Schmidt freebsd_committer freebsd_triage 2001-05-30 08:49:35 UTC
State Changed
From-To: open->closed

fixed  in current