Artifacts Associated With Ticket 1468052732
Ticket change [3e4d5f2962] (rid 218684) by anonymous on 2023-09-25 17:34:13:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-fossil-plain"
- comment initialized to:
Checkin b680b1f0b3 changes stub entry 33 from unsigned char *TclGetByteArrayFromObj(Tcl_Obj *objPtr, void *numBytesPtr) to unsigned char *Tcl_GetByteArrayFromObj(Tcl_Obj *objPtr, int *numBytesPtr) It also removes the previous declaration of Tcl_GetByteArrayFromObj: declare 653 { unsigned char *Tcl_GetByteArrayFromObj(Tcl_Obj *objPtr, Tcl_Size *numBytesPtr) } Shouldn't parameter numBytesPtr in entry 33 be a Tcl_Size* instead of int* ? Regards, Paul - foundin initialized to: "9.0"
- is_private initialized to: "0"
- login: "anonymous"
- priority initialized to: "5 Medium"
- private_contact initialized to: "2e499ca9e0149983f6f63603feedc5b33bc05f5e"
- resolution initialized to: "None"
- severity initialized to: "Minor"
- status initialized to: "Open"
- submitter initialized to: "anonymous"
- subsystem initialized to: "- New Stub Entries"
- title initialized to: "Changes to Tcl_GetByteArrayFromObj not correct?"
- type initialized to: "Bug"
Ticket change [dd9ff02d7d] (rid 218688) by apnadkarni on 2023-09-25 18:06:30:
- 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"
- icomment:
Ticket change [846e4bd764] (rid 218703) by jan.nijtmans on 2023-09-25 18:42:12:
- assignee changed to: "jan.nijtmans"
- closedate changed to: "2460213.279315"
- closer changed to: "jan.nijtmans"
- icomment:
> 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. The use for this function is [https://core.tcl-lang.org/tcl/file?name=generic/tclDecls.h&ci=35a5f655f5b9e16e&ln=4090-4093|here]. It isn't meant to be called directly by extensions. I would prefer your example code snippet to produce a compiler error, I'll think about it how to do that. Anyway, I don't like it when you hijack an unrelated ticket ..... Closing (since changing "int *" to "Tcl_Size *" was a good idea, reduces confusion
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Fixed"
- status changed to: "Closed"