OriginalBugID: 5636 Bug
Version: 8.2
SubmitDate: '2000-05-23'
LastModified: '2000-05-23'
Severity: SER
Status: Closed
Submitter: techsupp
ChangedBy: hobbs
RelatedBugIDs: 3466
OS: Windows NT
OSVersion: NT 4.0 sp 5
Machine: IBM 300PL / Pentium-II 400MHz
FixedDate: '2000-10-25'
ClosedDate: '2000-05-23'
Name:
Hillel Avni
ReproducibleScript:
in c++:
----
int t_mm()
{
char *buf = new char[100];
*(int *) buf = 0xd0800000; //or 0xd0900000 or 0xd0a00000 or 0xd0b00000
Tcl_Obj *t = Tcl_NewObj();
Tcl_AppendToObj (t, buf, 8);
Tcl_SetObjResult(interp, t);
}
in tcl:
---
set a [t_mm]
binary scan $a H* b
puts $b
ObservedBehavior:
input to t_mm, i.e - buf | output of tcl
-----------------+-----------
0xd0700000 | 0xd0700000
0xd0800000 | 0x00000000
0xd0900000 | 0x10000000
0xd0a00000 | 0x20000000
0xd0b00000 | 0x30000000
0xd0c00000 | 0xd0c00000
DesiredBehavior:
Same value on both raws.
This is prone to error. The user should create these byte
arrays with the Tcl_GetByteArrayFromObj and other Tcl ByteArray
C functions to maintain integrity (avoid UTF translation).
Also note the signed int dangers in bug report 3466.
-- 05/23/2000 hobbs
|