Repository navigation
tkinter.Tk segfault with invalid className #126219
Description
Activity
- addedtype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump
on Oct 31, 2024 (I think @graingert came up with the
tkinter.Tkrepro, I just ran it :) )Reacted by devdanzin- addedextension-modulesC modules in the Modules dirC modules in the Modules dir
on Oct 31, 2024 U+10FFFF is a valid code point but (edit) in a sense not a valid character. A nice choice for fuzzing. "There are also 66 non-characters. These are defined in part in Corrigendum #9: 34 values of the form U+nFFFE and U+nFFFF (where n is a value 0x00000, 0x10000, … 0xF0000, 0x100000), and 32 values U+FDD0 - U+FDEF."
tk doc says nothing directly about what is a class name but hints that is should be displayable. "Specifies a class for the window. ... Some window managers display the class name for windows in their dock ... ."
- added3.12only security fixesonly security fixes3.13only security fixesonly security fixes3.14bugs and security fixesbugs and security fixes
on Nov 16, 2024 I suspect that this is a Tk or Tcl bug. I do not see anything wrong on our side. Tcl before 9.0 does not support non-BMP characters well,
Tcl_UtfToUniChar()does not work, and somewhere they forget to check for error. This may be improved with Tcl 9.On other hand, it is not so easy to reproduce this with a pure Tcl --
subprocess.call(['\U0010FFFF'], executable='tclsh')does not crash. There should be something else to trigger a crash.- added 5 commits that reference this issue
on Jun 23, 2026 - added a commit that references this issue
on Jun 24, 2026 It is now a TclError.
Crash report
What happened?
It's possible to crash Python by passing an invalid
classNameto_tkinter.create, for example:Or, using
tkinter.Tk(repro thanks to @graingert and @JelleZijlstra):Backtrace looks like:
Found using fusil by @vstinner.
CPython versions tested on:
3.12, 3.14, CPython main branch
Operating systems tested on:
Linux, macOS, Windows
Output from running 'python -VV' on the command line:
Python 3.14.0a1+ (heads/main:d467d9246c, Oct 30 2024, 22:52:43) [GCC 11.4.0]
Linked PRs