Ticket #64 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

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.

Attachments

TRACEBACK (1.4 KB) - added by ampsaltis@… 3 years ago.
Traceback from old_str_util
str_util_fix.diff (0.8 KB) - added by ampsaltis@… 3 years ago.
Patch against str_util.c

Change History

Changed 3 years ago by ampsaltis@…

Traceback from old_str_util

Changed 3 years ago by ampsaltis@…

Patch against str_util.c

Changed 3 years ago by ian

  • status changed from new to closed
  • resolution set to fixed

applied your patch [1f48fd13fd4b]

Note: See TracTickets for help on using tickets.