Artifacts Associated With Ticket 218974ffffffffff
Ticket change [aef7fcad6a] (rid 97729) by nobody on 2000-10-26 01:08:50:
- assignee initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
OriginalBugID: 3380 Bug Version: 8.2.1 SubmitDate: '1999-11-05' LastModified: '1999-11-11' Severity: MED Status: Released Submitter: techsupp ChangedBy: hobbs OS: Windows NT OSVersion: 4.0 sp4 FixedDate: '1999-11-11' FixedInVersion: 8.2.3 ClosedDate: '2000-10-25' Name: Martin Grosz Comments: I am using Windows NT & VC++ 6.0 & SWIG. My code is in a 'load'ed .dll ReproducibleScript: Create a unicode string: Tcl_UniChar * unicode = L"my unic string"; Get an object pointer. tcl_result = Tcl_GetObjResult(interp); Make the call: Tcl_SetUnicodeObj( tcl_result, _result, -1 ); results in a memory access error trying to read invalid address in memcpy. Using this call instead works: Tcl_SetUnicodeObj( tcl_result, _result, ::wcslen(_result) ); Documentation says: "int numChars (in) The number of Unicode characters to copy from unicode when initializing, setting, or appending to a string object. If negative, all characters up to the first null character are used." WRONG!!! ObservedBehavior: Unhandled exception in tclsh82.exe (MSVCRTD.DLL): 0xC0000005: Access Violation stack memcpy(unsigned char * 0x00333fac, unsigned char * 0x011f2e40, unsigned long 0xfffffffe) line 171 Tcl_SetUnicodeObj(Tcl_Obj * 0x0029f950, unsigned short * 0x011f2e40, int 0xffffffff) line 727 + 22 bytes _wrap_ComputerNameGet(void * 0x00000000, Tcl_Interp * 0x002b2d28, int 0x00000001, Tcl_Obj * const * 0x002db5e8) line 1939 + 18 bytes TclExecuteByteCode(Tcl_Interp * 0x002b2d28, ByteCode * 0x002c6388) line 844 + 25 bytes Tcl_EvalObjEx(Tcl_Interp * 0x002b2d28, Tcl_Obj * 0x0029eaa0, int 0x00000000) line 2698 + 13 bytes Tcl_RecordAndEvalObj(Tcl_Interp * 0x002b2d28, Tcl_Obj * 0x0029eaa0, int 0x00000000) line 142 + 23 bytes Tcl_Main(int 0x00000001, char * * 0x00283488, int (Tcl_Interp *)* 0x0040103d Tcl_AppInit(Tcl_Interp *)) line 236 + 21 bytes main() line 64 + 19 bytes mainCRTStartup() line 338 + 17 bytes KERNEL32! 77f1ba3c() DesiredBehavior: Documentation says: "int numChars (in) The number of Unicode characters to copy from unicode when initializing, setting, or appending to a string object. If negative, all characters up to the first null character are used." Somehow the whole UnicodeObj set of functions missed the handling of numChars < 0. -- 11/11/1999 hobbs The correct checks were added to Tcl_(New|Set)UnicodeObj and the private funcs that Tcl_AppendUnicodeToObj calls. -- 11/11/1999 hobbs - foundin initialized to: "obsolete: 8.2.1"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "nobody"
- subsystem initialized to: "10. Objects"
- title initialized to:
Tcl_SetUnicodeObj(objPtr, unicode, numChars) fails if numCha
- type initialized to: "Bug"
Ticket change [31f9201ea0] (rid 93526) by welch on 2000-10-26 08:32:16:
- closedate changed to: "2000-10-26T01:32:16"
- closer changed to: "welch"
- priority changed to: "2"
- resolution changed to: "Fixed"
- status changed to: "Closed"