From: SourceForge.net <no...@so...> - 2006-04-25 08:16:13
|
Bugs item #1475865, was opened at 2006-04-25 01:01 Message generated for change (Comment added) made by dkf You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112997&aid=1475865&group_id=12997 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: 46. Unix Fonts Group: current: 8.5a3 Status: Open Resolution: None >Priority: 8 Submitted By: Brian Griffin (bgriffin) >Assigned to: Donal K. Fellows (dkf) Summary: Crash in font families Initial Comment: Althought I have been unable to reproduce this, a customer of ours reported a crash on a new RedHat system that I've tracked down to the code below from tkUnixFont.c. This is in 8.4.9, but the code is the same in the current HEAD (8.5). The crash is in strchar() and my theory is that ListFonts() is returning a font name that does not contain a '-' or contains only 1 '-'. In any event, good programming practice would dictate that a test for a NULL return value would be in order here. void TkpGetFontFamilies(interp, tkwin) Tcl_Interp *interp; /* Interp to hold result. */ Tk_Window tkwin; /* For display to query. */ { int i, new, numNames; char *family; Tcl_HashTable familyTable; Tcl_HashEntry *hPtr; Tcl_HashSearch search; char **nameList; Tcl_Obj *resultPtr, *strPtr; resultPtr = Tcl_GetObjResult(interp); Tcl_InitHashTable(&familyTable, TCL_STRING_KEYS); nameList = ListFonts(Tk_Display(tkwin), "*", &numNames); for (i = 0; i < numNames; i++) { family = strchr(nameList[i] + 1, '-') + 1; strchr(family, '-')[0] = '\0'; Tcl_CreateHashEntry(&familyTable, family, &new); } XFreeFontNames(nameList); hPtr = Tcl_FirstHashEntry(&familyTable, &search); while (hPtr != NULL) { strPtr = Tcl_NewStringObj(Tcl_GetHashKey(&familyTable, hPtr), -1); Tcl_ListObjAppendElement(NULL, resultPtr, strPtr); hPtr = Tcl_NextHashEntry(&search); } Tcl_DeleteHashTable(&familyTable); } ---------------------------------------------------------------------- >Comment By: Donal K. Fellows (dkf) Date: 2006-04-25 09:16 Message: Logged In: YES user_id=79902 Fixed in HEAD with attached patch ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112997&aid=1475865&group_id=12997 |