Overview
| Artifact ID: | 58e788fd809be017682fcd86ed7332c66c2671bbb525647911a89f6d6a3dfec5 |
|---|---|
| Ticket: | 0e8fd6c6d5fd2f29f90c6e101197796951e399d6
(unsigned)STRING_SIZE(STRING_MAXCHARS) is 0 |
| User & Date: | chrstphrchvz on 2022-03-22 02:02:17 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/x-fossil-wiki"
- comment changed to:
…causing <tt>stringAlloc(STRING_MAXCHARS)</tt> or similar to eventually lead to a crash or noticeable memory corruption. Example: <pre> set a [string repeat a 1073741820] # crash when attempting to create string with longest possible unicode rep and no string rep set aa [string replace $a 0 0 $a ] </pre> After <tt>TCLFLEXARRAY</tt> ([29540d10c4]) was introduced, <tt>STRING_MAXCHARS</tt> was updated ([3a6a0399ad]), but the <tt>…- 1…</tt> seems to be misplaced (it currently makes no difference in the numerator of the expression): see attached patch. <tt>STRING_MAXCHARS</tt> apparently should return 1 less than what it currently does (i.e. 2147483638 rather than 2147483639, for 32-bit <tt>int</tt> and 16-bit <tt>Tcl_UniChar</tt>). To my knowledge there are no similar issues for other structures using <tt>TCLFLEXARRAY</tt>.
- 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: "(unsigned)STRING_SIZE(STRING_MAXCHARS) is 0"
- type changed to: "Patch"