Overview
| Artifact ID: | 9241e84ed8c89875e507047788c734a41dc53956ae873c3c20b24030539d14a0 |
|---|---|
| Ticket: | 112e7aa36dbfc3e12be9b32968593729ca6f6264
signed integer overflow in Tcl_SetObjLength(), Tcl_AttemptSetObjLength() |
| User & Date: | chrstphrchvz on 2022-03-05 22:48:06 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/x-fossil-wiki"
- comment changed to:
Calling <tt>Tcl_SetObjLength(…, INT_MAX)</tt> or <tt>Tcl_AttemptSetObjLength(…, INT_MAX)</tt> leads to signed integer overflow. The attached patch avoids this. Example UBSan error: <pre> <span style="font-weight:bold">tcl/generic/tclStringObj.c:961:27:<span style="color:red"> runtime error: </span>signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'</span> </pre> Example test case to add to stringObj.test (likely not desirable for Tcl to adopt—will panic on systems with insufficient memory): <pre> test stringObj-4.99 {Tcl_SetObjLength procedure, string lengthened to INT_MAX} testobj { testobj freeallvars teststringobj set 1 abcdef teststringobj setlength 1 [expr 2**31-1] list [teststringobj length 1] } [list [expr 2**31-1]] </pre> - foundin changed to: "core-8-6-branch"
- is_private changed to: "0"
- login: "chrstphrchvz"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- severity changed to: "Minor"
- status changed to: "Open"
- submitter changed to: "chrstphrchvz"
- subsystem changed to: "10. Objects"
- title changed to:
signed integer overflow in Tcl_SetObjLength(), Tcl_AttemptSetObjLength()
- type changed to: "Patch"