Overview
| Artifact ID: | af9b44799150fb98e06faf43b372f17039027e9f4c9a2c558c71378fd02f1286 |
|---|---|
| Ticket: | f4b0cb208044f175bdd669db0b293d0bf3f9108e
Calling Tcl_GetStringFromObj with NULL lengthPtr causes compile error |
| User & Date: | anticrisis on 2021-01-25 08:30:06 |
Changes
- comment changed to:
Code recently introduced in tclDecls.h to handle 64 bit issues causes compile errors when NULL (0) is used as a lengthPtr. This is a common practice when using this function, and is a documented feature. Here is a godbolt link to an isolated sample. Note that calling Tcl_GetStringFromObj with 0 as the lengthPtr argument causes a compile error. https://godbolt.org/z/vxzv53 The problem is this, in tclDecls.h: #define Tcl_GetStringFromObj(objPtr, sizePtr) \ (sizeof(*sizePtr) <= sizeof(int) ? tclStubsPtr->tcl_GetStringFromObj(objPtr, (int *)sizePtr) : tclStubsPtr->tclGetStringFromObj(objPtr, (size_t *)sizePtr)) This macro fails if sizePtr is 0, because (*sizePtr) is not valid C code. Documentation for Tcl_GetStringFromObj indicates that sizePtr may be NULL, but this macro does not allow that. - login: "anticrisis"
- mimetype: "text/plain"
- priority changed to: "6"
- title changed to:
Calling Tcl_GetStringFromObj with NULL lengthPtr causes compile error