Artifacts Associated With Ticket 3129448
Ticket change [8ef3114b57] (rid 120207) by nijtmans on 2010-12-06 08:44:52:
- assignee initialized to: "hobbs"
- cmimetype initialized to: "text/plain"
- comment initialized to:
Inspired by bug #3127687, noted that on 64-bit platforms, where sizeof(integer) == 8, some structures are over-allocated because sizeof() might count additional padding bytes. That's no big deal, except that it is strange anyway to use [4] as the number of bytes in the structure. Solution: use the TclOffset macro to calculate the right size, in stead of substracting two sizeof()'s. That will correctly take padding bytes into account. patch attached
- foundin initialized to: "obsolete: 8.6b1.1"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "nijtmans"
- subsystem initialized to: "41. Memory Allocation"
- title initialized to: "possible over-allocation on 64-bit platforms"
- type initialized to: "Bug"
Ticket change [74d0d1fb27] (rid 105278) by nijtmans on 2010-12-06 15:45:26:
- assignee changed to: "nijtmans"
Add attachment "3129448.patch" [4b3c9ac2e6] (rid 126665) by nijtmans on 2010-12-06 15:46:40.
Ticket change [0f24ce7e18] (rid 94743) by nijtmans on 2010-12-06 15:46:41:
- icomment:
File Added - 395354: 3129448.patch
- login: "nijtmans"
- mimetype: "text/plain"
- username: "nijtmans"
- icomment:
Ticket change [931f755607] (rid 105762) by nijtmans on 2010-12-06 16:02:31:
- closedate changed to: "2010-12-06T09:02:31"
- closer changed to: "nijtmans"
- icomment:
allow_comments - 1 Fixed in HEAD don't bother for Tcl 8.5 and lower
- login: "nijtmans"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- username: "nijtmans"
Ticket change [22b33f2ebf] (rid 130799) by dgp on 2010-12-06 21:49:51:
- icomment:
what does "integer" mean in this report? int ? long int ?
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [d2890a1eef] (rid 113544) by dgp on 2010-12-06 21:54:28:
- icomment:
Hmmm... the actual patch applies doesn't appear to have anything to do with integers, but with pointer sizes and alignment matters. Is there a platform on which the effectiveness of the patch is actually tested?
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [43326406b2] (rid 116510) by nijtmans on 2010-12-06 23:12:12:
- icomment:
Here is a small test program (try it on any UNIX machine) which shows the dirrerence between substracting two sizes or determining the offset. This program prints: 12 8 Here I used a long long as data type in stead of an int. It will occur on any machine where sizeof(int) = 8. ===================================================== #include <stdio.h> #define TclOffset(type, field) \ ((int) ((char *) &((type *) 0)->field)) typedef struct { long long dummy; char buf[4]; } mytype; void main() { mytype x; int answer1 = sizeof(x) - sizeof(x.buf); int answer2 = (unsigned)TclOffset(mytype, buf); printf("%d %d\n", answer1, answer2); } - login: "nijtmans"
- mimetype: "text/plain"
- username: "nijtmans"
- icomment:
Ticket change [0f1567927d] (rid 94731) by nijtmans on 2010-12-11 04:55:55:
- icomment:
Part 2, a few more places where the same pattern was used. Patch attached.
- login: "nijtmans"
- mimetype: "text/plain"
- username: "nijtmans"
- icomment:
Add attachment "3129448_2.patch" [fda86e9eb3] (rid 108443) by nijtmans on 2010-12-11 04:56:25.
Ticket change [212d4305c2] (rid 130540) by nijtmans on 2010-12-11 04:56:25:
- icomment:
File Added - 395809: 3129448_2.patch
- login: "nijtmans"
- mimetype: "text/plain"
- username: "nijtmans"
- icomment:
Ticket change [f297ba27d4] (rid 109578) by nijtmans on 2011-01-25 22:57:50:
- icomment:
backported strcpy->memcpy changes to 8.5 and 8.4 as well, not any other struct change
- login: "nijtmans"
- mimetype: "text/plain"
- username: "nijtmans"
- icomment: