Overview
| Artifact ID: | aef7fcad6a4c07e410dba02272800367f190df95 |
|---|---|
| Ticket: | 218974ffffffffffffffffffffffffffffffffff
Tcl_SetUnicodeObj(objPtr, unicode, numChars) fails if numCha |
| User & Date: | nobody on 2000-10-26 01:08:50 |
Changes
- assignee changed to: "nobody"
- cmimetype changed to: "text/plain"
- comment changed 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 changed to: "obsolete: 8.2.1"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "nobody"
- subsystem changed to: "10. Objects"
- title changed to:
Tcl_SetUnicodeObj(objPtr, unicode, numChars) fails if numCha
- type changed to: "Bug"