| Ticket UUID: | e17b6f008f178d71f251756da637ff663186bb1a | |||
| Title: | unixWm-50.4 crashes OSX Aqua | |||
| Type: | Bug | Version: | 8.6 | |
| Submitter: | dgp | Created on: | 2017-01-24 23:42:49 | |
| Subsystem: | 86. Test Tools | Assigned To: | jan.nijtmans | |
| Priority: | 5 Medium | Severity: | Critical | |
| Status: | Closed | Last Modified: | 2022-09-08 09:29:41 | |
| Resolution: | Fixed | Closed By: | jan.nijtmans | |
| Closed on: | 2022-09-08 09:29:41 | |||
| Description: |
make -C tk${ver}/macosx TESTFLAGS='-match unixWm-50.4 -file unixWm.test' test
2017-01-24 18:38:14.101 tktest[46679:507] *** Assertion failure in -[TKWindow setTitle:], /SourceCache/AppKit/AppKit-1265.21/AppKit.subproj/NSWindow.m:2901
2017-01-24 18:38:14.103 tktest[46679:507] An uncaught exception was raised
2017-01-24 18:38:14.103 tktest[46679:507] Invalid parameter not satisfying: aString != nil
...
| |||
| User Comments: |
jan.nijtmans added on 2022-09-08 09:29:41:
Proposed fix now merged to core-8-6-branch and trunk jan.nijtmans added on 2022-09-07 20:46:28: Proposed fix [88804991b67bbb55|here]. This way, NSString can never be initialized with an invalid UTF-8 string. jan.nijtmans added on 2022-09-06 10:42:53: > Would this be an appropriate fix? Yes, I think so. Most likely, the same change would be appropriate in lots of other places, maybe even all of them ... chrstphrchvz added on 2022-09-06 10:03:59: Would this be an appropriate fix?
--- macosx/tkMacOSXWm.c
+++ macosx/tkMacOSXWm.c
@@ -5420,7 +5420,7 @@ TkSetWMName(
return;
}
- NSString *title = [[NSString alloc] initWithUTF8String:titleUid];
+ NSString *title = [[TKNSString alloc] initWithTclUtfBytes:titleUid length:-1];
[TkMacOSXGetNSWindowForDrawable(winPtr->window) setTitle:title];
[title release];
}
chrstphrchvz added on 2022-09-06 06:10:24: Did dgp mean to put core-8-6-branch as the version rather than core-8-5-branch? I do not know exactly what Tcl script commands led to this crash, but I do see how it could happen. At the time, the only call to the NSWindow setTitle: method was from TkSetWmName(). That function first tries to convert titleUid to an NSString using initWithUTF8String:, and then pass the NSString to setTitle:. The problem is that titleUid is not necessarily valid UTF-8. If it isn’t valid UTF-8, initWithUTF8String: will return nil, and doing setTitle:nil will trigger an exception. Example which currently crashes for core-8-6-branch: wm title . \u0000 titleUid will be "\xc0\x80", which is not valid UTF-8. dgp added on 2017-01-30 15:29:30: core-8-6-branch OSX 10.9.5 fvogel added on 2017-01-29 19:52:16: What branch? For what I can see on Mac OS X Sierra 10.12.2 with core-8-6-branch this test does not crash, but fails as follows:
==== unixWm-50.4 Tk_CoordsToWindow procedure, window in other application FAILED
==== Contents of test case:
destroy .t
catch {interp delete slave}
toplevel .t -width 200 -height 200 -bg green
wm geometry .t +0+0
tkwait visibility .t
interp create slave
load {} Tk slave
slave eval {wm geometry . 200x200+0+0; tkwait visibility .}
set result [list [winfo containing 100 100] [slave eval {winfo containing 100 100}]]
interp delete slave
set result
---- Result was:
. .
---- Result should have been (exact matching):
{} .
==== unixWm-50.4 FAILED
| |||
Home
Timeline
Branches
Tags
Forum
Tickets
Download
Wiki