Overview
| Artifact ID: | c22669188addc70faa14110e4146222f883370f9425279ebc40c66e382b8bfcb |
|---|---|
| Ticket: | 05ff16e799ef5d6d15ad1330425f243e5c49d13f
signed integer overflow in ExtendStringRepWithUnicode() |
| User & Date: | chrstphrchvz on 2022-04-07 18:58:01 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/x-fossil-wiki"
- comment changed to:
Example script (assumes your Tcl already has the fix for [0e8fd6c6d5]): <blockquote> <pre> set z [string repeat "\u0000" 1073741820] puts stderr [::tcl::unsupported::representation $z]<br /> # create string obj with longest possible unicode rep and no string rep set zz [string replace $z 0 1 $z] puts stderr [::tcl::unsupported::representation $zz]<br /> # force generating string rep (should abort due to exceeding max size for a Tcl value) set ZZ [string toupper $zz] puts stderr [::tcl::unsupported::representation $ZZ] </pre> </blockquote> Output containing UBSan <tt>-fsanitize=signed-integer-overflow</tt> error (which the attached patch prevents): <blockquote> <pre> value is a pure string with a refcount of 2, object pointer at 0x604000041490, string representation "..." value is a string with a refcount of 2, object pointer at 0x604000041c10, internal representation 0x316793800:0xbebebebebebebebe, no string representation <span style="font-weight:bold">tcl/generic/tclStringObj.c:3344:7: <span style="color:firebrick">runtime error:</span> signed integer overflow: 2147483646 + 2 cannot be represented in type 'int'</span> max size for a Tcl value (2147483647 bytes) exceeded </pre> (tclsh aborted) </blockquote>
- 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 ExtendStringRepWithUnicode()
- type changed to: "Patch"