Overview
| Artifact ID: | dd9ff02d7d1b960de65ab8d9afb8c3d6f377576d5e7aefaf79e213ff69266a96 |
|---|---|
| Ticket: | 14680527328fdcadb5e558c998621d28eb607db4
Changes to Tcl_GetByteArrayFromObj not correct? |
| User & Date: | apnadkarni on 2023-09-25 18:06:30 |
Changes
- icomment:
Along the same lines (but not part of same commit), in Tcl 9 the current definition of Stub 41 is ``` declare 41 { char *TclGetStringFromObj(Tcl_Obj *objPtr, void *lengthPtr) } ``` However, TclGetStringFromObj **always** treats lengthPtr as an `int *`. Thus following a "conflict-free" merge from core-8-branch, the following fragment caused a crash. ``` Tcl_Size len; const char *path = TclGetStringFromObj(normPathPtr, &len); ... path[len-1] = '\0'; ``` because only the low four bytes of `len` were updated by the TGSFO call. Either Stub 41 should be removed, or defined as taking an `int*` so that compiler will catch these errors. The way it is currently defined serves no utility afaict but I'm wary of changing it myself in case there is some use I don't see. Alternately, define it as taking an `Tcl_Size *` and name it as `Tcl_GetStringFromObj` replacing stub 651. - login: "apnadkarni"
- mimetype: "text/plain"