Overview
| Artifact ID: | 4d6ae66449ce35ff2c84e4c366708a4b0e00cdff |
|---|---|
| Ticket: | 615304ffffffffffffffffffffffffffffffffff
Tcl_InitStubs crash/exception |
| User & Date: | nobody on 2002-10-03 02:50:34 |
Changes
- icomment:
Logged In: NO When I stepped through the code (several times) to diagnose the problem, I noticed that the variable "tclStubsPtr" is never being reset to NULL. Additionally, it does not appear to ever be explicitly initialized to NULL. CONST char * Tcl_InitStubs (interp, version, exact) Tcl_Interp *interp; CONST char *version; int exact; { CONST char *actualVersion; TclStubs *tmp; if (!tclStubsPtr) { //*** NOTE: The first time through here, the tclStubsPtr is set to the one from the interp. //*** Since the tclStubsPtr is never explicitly reset (at least, not that I can find), this code is not executed the second time through. tclStubsPtr = HasStubSupport(interp); if (!tclStubsPtr) { return NULL; } } //*** I'm not sure what the "tmp" variable here is doing. //*** Upon close examination, I believe the cause of the crash is a bad address for Tcl_PkgRequireEx, as this is a macro defined to be "tclStubsPtr->tcl_PkgRequireEx". //*** Since the tclStubsPtr variable does not really exist in a known state after the first time around (or really, at all), by the time the second time roles around there is somehow total garbage in the tclStubsPtr that a simple call to HasStubSupport seems to fix. This is due to the fact that Tcl_CreateInterp actually sets up the internal stubs table inside the interp prior to Tcl_InitStubs ever being called, and I believe that Tcl_InitStubs should always rely on those values alone. actualVersion = Tcl_PkgRequireEx(interp, "Tcl", version, exact, (ClientData *) &tmp); if (actualVersion == NULL) { tclStubsPtr = NULL; return NULL; } if (tclStubsPtr->hooks) { tclPlatStubsPtr = tclStubsPtr->hooks- >tclPlatStubs; tclIntStubsPtr = tclStubsPtr->hooks- >tclIntStubs; tclIntPlatStubsPtr = tclStubsPtr->hooks- >tclIntPlatStubs; } else { tclPlatStubsPtr = NULL; tclIntStubsPtr = NULL; tclIntPlatStubsPtr = NULL; } return actualVersion; } JJM - login: "nobody"
- mimetype: "text/plain"
- username: "nobody"