| Ticket UUID: | 2236352 | |||
| Title: | NULL dereference as result of peculiarly formed font name | |||
| Type: | Bug | Version: | obsolete: 8.4.17 | |
| Submitter: | thyrsus | Created on: | 2008-11-07 20:17:06 | |
| Subsystem: | 46. Unix Fonts | Assigned To: | hobbs | |
| Priority: | 5 Medium | Severity: | ||
| Status: | Closed | Last Modified: | 2026-10-23 10:16:38 | |
| Resolution: | Fixed | Closed By: | serhiy.storchaka | |
| Closed on: | 2026-10-23 10:16:38 | |||
| Description: |
I'm running Fedora 8; I don't see any changes between tk8.4.17 and tk8.4.19 that would fix this. If I must run 8.4.19 to have this addressed, please explain to me how I can install 8.4.19 without breaking system dependencies.
A weird font name, "-misc-????-bold-r-normal--17-120-100-100-p-0-iso8859-1",
is causing TkFontParseXLFD to return bad results, including a NULL pointer for the font family and a negative number for the font size. I'd like TkFontParseXLFD to detect bad return values from the functions it calls and return TCL_ERROR when it sees them.
Here's some of the gdb session where the error occurs:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1208772928 (LWP 18846)]
0x002866b9 in strcasecmp () from /lib/libc.so.6
Missing separate debuginfos, use: debuginfo-install python.i386
(gdb) bt
#0 0x002866b9 in strcasecmp () from /lib/libc.so.6
#1 0x00d7bbca in IdentifySymbolEncodings (faPtr=0xbfd4fef4)
at /usr/src/debug/tk8.4.17/unix/tkUnixFont.c:2857
#2 0x00d7c4f5 in CanUseFallback (fontPtr=0x8ddb518,
faceName=<value optimized out>, ch=20092, fixSubFontPtrPtr=0x0)
at /usr/src/debug/tk8.4.17/unix/tkUnixFont.c:2361
#3 0x00d7cea1 in FindSubFontForChar (fontPtr=0x8ddb518, ch=20092,
fixSubFontPtrPtr=0x0) at /usr/src/debug/tk8.4.17/unix/tkUnixFont.c:1961
#4 0x00d7d4be in Tk_MeasureChars (tkfont=0x8ddb518,
source=0x93a106a "'(a�\211ΩB�\201\205乼cz):\\n'\n", numBytes=21,
maxLength=411, flags=0, lengthPtr=0xbfd50358)
at /usr/src/debug/tk8.4.17/unix/tkUnixFont.c:1083
#5 0x00d68e80 in MeasureChars (tkfont=0x8ddb518,
source=0x93a106a "'(a�\211ΩB�\201\205乼cz):\\n'\n",
maxBytes=<value optimized out>, startX=0, maxX=411, tabOrigin=0,
nextXPtr=0xbfd503a4) at /usr/src/debug/tk8.4.17/generic/tkTextDisp.c:5265
#6 0x00d6905d in TkTextCharLayoutProc (textPtr=0x8c54518,
indexPtr=0xbfd50564, segPtr=0x93a1030, byteOffset=46, maxX=411,
maxBytes=22, noCharsYet=1, wrapMode=TEXT_WRAPMODE_WORD, chunkPtr=0x93a5e38)
at /usr/src/debug/tk8.4.17/generic/tkTextDisp.c:4534
#7 0x00d6a739 in LayoutDLine (textPtr=0x8c54518,
indexPtr=<value optimized out>)
at /usr/src/debug/tk8.4.17/generic/tkTextDisp.c:1017
#8 0x00d6b068 in UpdateDisplayInfo (textPtr=0x8c54518)
---Type <return> to continue, or q <return> to quit---
at /usr/src/debug/tk8.4.17/generic/tkTextDisp.c:1333
#9 0x00d6b939 in TkTextPixelIndex (textPtr=0x0, x=1, y=377,
indexPtr=0xbfd50698) at /usr/src/debug/tk8.4.17/generic/tkTextDisp.c:4181
#10 0x00d72b39 in TkTextPickCurrent (textPtr=0x8c54518, eventPtr=0x8c546cc)
at /usr/src/debug/tk8.4.17/generic/tkTextTag.c:1410
#11 0x00d6cc47 in DisplayText (clientData=0x8c54518)
at /usr/src/debug/tk8.4.17/generic/tkTextDisp.c:2281
#12 0x00441af8 in TclServiceIdle () from /usr/lib/libtcl8.4.so
#13 0x0042f24f in Tcl_DoOneEvent () from /usr/lib/libtcl8.4.so
#14 0x0012c6ec in ?? () from /usr/lib/python2.5/lib-dynload/_tkinter.so
#15 0x05e617ed in PyCFunction_Call () from /usr/lib/libpython2.5.so.1.0
#16 0x05eaec72 in PyEval_EvalFrameEx () from /usr/lib/libpython2.5.so.1.0
#17 0x05eaf6bf in PyEval_EvalCodeEx () from /usr/lib/libpython2.5.so.1.0
#18 0x05ead844 in PyEval_EvalFrameEx () from /usr/lib/libpython2.5.so.1.0
#19 0x05eadfcd in PyEval_EvalFrameEx () from /usr/lib/libpython2.5.so.1.0
#20 0x05eaf6bf in PyEval_EvalCodeEx () from /usr/lib/libpython2.5.so.1.0
#21 0x05ead844 in PyEval_EvalFrameEx () from /usr/lib/libpython2.5.so.1.0
#22 0x05eaf6bf in PyEval_EvalCodeEx () from /usr/lib/libpython2.5.so.1.0
#23 0x05eaf743 in PyEval_EvalCode () from /usr/lib/libpython2.5.so.1.0
#24 0x05ec93e6 in ?? () from /usr/lib/libpython2.5.so.1.0
#25 0x05ec949e in PyRun_FileExFlags () from /usr/lib/libpython2.5.so.1.0
#26 0x05ecab58 in PyRun_SimpleFileExFlags () from /usr/lib/libpython2.5.so.1.0
#27 0x05ecb2ba in PyRun_AnyFileExFlags () from /usr/lib/libpython2.5.so.1.0
#28 0x05ed4e06 in Py_Main () from /usr/lib/libpython2.5.so.1.0
---Type <return> to continue, or q <return> to quit---
#29 0x080485d2 in main ()
(gdb) frame
#0 0x002866b9 in strcasecmp () from /lib/libc.so.6
(gdb) frame 1
#1 0x00d7bbca in IdentifySymbolEncodings (faPtr=0xbfd4fef4)
at /usr/src/debug/tk8.4.17/unix/tkUnixFont.c:2857
2857 if (strcasecmp(faPtr->fa.family, symbolClass[i]) == 0) {
(gdb) print faPtr->fa.family
$1 = 0x0
(gdb) print faPtr->fa
$2 = {family = 0x0, size = -17, weight = 1, slant = 0, underline = 0,
overstrike = 0}
(gdb) print *faPtr
$3 = {fa = {family = 0x0, size = -17, weight = 1, slant = 0, underline = 0,
overstrike = 0}, xa = {foundry = 0x8c56748 "misc", slant = 0,
setwidth = 0, charset = 0x99c07f0 "iso8859-1"}}
(gdb) frame 2
#2 0x00d7c4f5 in CanUseFallback (fontPtr=0x8ddb518,
faceName=<value optimized out>, ch=20092, fixSubFontPtrPtr=0x0)
at /usr/src/debug/tk8.4.17/unix/tkUnixFont.c:2361
2361 IdentifySymbolEncodings(&got);
(gdb) print got
$4 = {fa = {family = 0x0, size = -17, weight = 1, slant = 0, underline = 0,
overstrike = 0}, xa = {foundry = 0x8c56748 "misc", slant = 0,
setwidth = 0, charset = 0x99c07f0 "iso8859-1"}}
(gdb) p nameList[nameIdx]
$5 = 0x8d6ee21 "-misc-????-bold-r-normal--17-120-100-100-p-0-iso8859-1"
(gdb)
| |||
| User Comments: |
serhiy.storchaka added on 2026-10-23 10:16:38:
Merged into main [d26ddd6f28], 9.0 [ec6c013eee] and 8.6 [16ff7e43ec]. serhiy.storchaka added on 2026-09-17 17:58:33: Still present in 9.1 with a core-font ( Fixed on branch bug-2236352 in [70fa3ec2b4]. The attached patch was not used: thyrsus added on 2008-11-08 07:23:34: By the way: I apparently don't understand how font sizes are represented; it is apparently correct for the font size to be negative. Also, my patch doesn't protect against "????" appearing in the foundry field; you probably want to protect against that as well. thyrsus added on 2008-11-08 07:16:53: File Added - 300622: tk-XLFD.patch This attached patch resolves the problem for me. File Added: tk-XLFD.patch | |||
Attachments:
- tk-XLFD.patch [download] added by thyrsus on 2008-11-08 07:16:53. [details]
