I'd like to propose a patch which fixes segfault when matching exact string with non-ASCII in it (in fact when UTF-8 bytelength is greater than Unicode cahracter length).
The bug description with a simple script which triggers it can be found at http://groups.google.com/group/comp.lang.tcl/browse_thread/thread/8ea4b666c2f31cac#
Another bugreport is at Ubuntu tracker (though it's incomplete, but the segfault is at the same code fragment). See https://bugs.launchpad.net/ubuntu/+source/expect/+bug/608343
The issue seems to be in matching function where UTF-8 pattern is used to match Tcl_UniChar string. The matching itself is fine, but the length of matched string segment is calculated incorrectly as a UTF-8 bytelength of the pattern. The attached patch switches to Tcl_UniChar pattern.
Log in to post a comment.