Subject: | Parameter size mismatch causes segfaults |
In working on fixing a core perl5 bug affecting Tk, I had to make several changes to get Tk to work on a 64 bit system. These stemmed from the fact that size_t is 8 bytes on this system, and int is 4. Most of these were involved in calling Tcl_GetStringFromObj(). The length parameter really should be a size_t or ssize_t, and in a few places it is. But the function declares it to be an int, and various callers attempt to cast their size_t* variables to int*. THIS DOES NOT WORK. It may compile, but the value returned will be garbage. Most places have the parameter declared to be an int, and this appears to work. But that int may overflow on 64 bit systems, so they all should be converted to size_t or ssize_t. Because I was only interested in cobbling together something that I could use temporarily, I converted everything to int's, which was enough to get me by. I am attaching my changes to this ticket.
Another place where there was a pointer parameter length mismatch is in the call to SvPV at line 630 in objGlue.c
Compiling this with a recent gcc version raised many more warnings, some of which looked really serious.
Subject: | objGlue.o |
Message body not shown because it is not plain text.
Subject: | tkCanvText.c |
Message body is not shown because it is too large.
Subject: | tkFrame.c |
Message body is not shown because it is too large.