Ticket #64 (closed defect: fixed)
str_util segfaults in is_wide_char
| Reported by: | ampsaltis@… | Owned by: | ian |
|---|---|---|---|
| Priority: | minor | Milestone: | |
| Component: | widgets | Version: | |
| Keywords: | Cc: |
Description
Due to coding errors on my fault, I managed to pass mouse events (tuples) as Edit keypresses (generally strings). When urwid checked whether the "keypress" was valid, it tried to subscript them, which would (I theorize) return pointers to strings instead of the characters themselves. Thus causing the segfault in question.
This was (sort of) protected by an assert statement in "old_str_util.py" (near line 221). It seems to be skipped many times, resulting in the attached traceback. However, for some reason, this assert isn't even in str_util.c. Once I added code that essentially restored that check, the program now dies on an exception instead of SIGSEGV. I am not sure if it actually allows for unicode strings to pass through, but adding code for should be negligible.
I have attached the aforementioned traceback, and a diff against the latest urwid in hg.
