Artifacts Associated With Ticket 43b434812a6e79e3
Ticket change [6089758f12] (rid 185635) by chrstphrchvz on 2020-08-21 09:28:27:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-fossil-wiki"
- comment initialized to:
Using Ubuntu 18.04 i686 (32 bit Intel), Tcl 9.0 ([c1e3046f2f]) appears to configure with <tt>TclOSstat()</tt> defined as <tt>stat64()</tt>, but also with <tt>Tcl_StatBuf</tt> defined to <tt>struct stat</tt> rather than <tt>struct stat64</tt>. Since <tt>struct stat64</tt> is larger (96 bytes rather than 88), calling <tt>stat64()</tt> with a pointer to <tt>struct stat</tt> will write to memory outside of the <tt>struct stat</tt>. (The <tt>struct stat</tt> is likely also invalid after doing so.) I notice this because I can't even start tclsh9.0 without it crashing in <tt>TclpMatchInDirectory()</tt> (tclUnixFile.c): calling <tt>TclOSstat()</tt> (<tt>stat64()</tt>) at line 312 clobbers the address stored in <tt>ds.string</tt>, and when <tt>Tcl_DStringSetLength()</tt> is called at line 380, it writes to an invalid address when doing <tt>dsPtr->string[length] = 0</tt> (tclUtil.c line 2808). I don't observe this issue in Tcl 8.7 ([95051c8d1e]) where <tt>TclOSstat()</tt> and <tt>Tcl_StatBuf</tt> are defined as <tt>stat64()</tt> and <tt>struct stat64</tt> respectively.
- foundin initialized to: "9.0"
- is_private initialized to: "0"
- login: "chrstphrchvz"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- severity initialized to: "Minor"
- status initialized to: "Open"
- submitter initialized to: "chrstphrchvz"
- subsystem initialized to: "37. File System"
- title initialized to:
Tcl 9.0 uses stat64() but not struct stat64 on Linux i686
- type initialized to: "Bug"
Ticket change [d87fc87666] (rid 185636) by jan.nijtmans on 2020-08-21 10:05:55:
- assignee changed to: "jan.nijtmans"
- icomment:
See also the comments in this ticket: [https://core.tcl-lang.org/tcl/info/02b58d5d04] Tcl 9.0 should use "Implicit LFS", while Tcl 8.x uses "Explicit LFS". What's missing is the "configure" part of determining `$(getconf LFS_CFLAGS)`, `$(getconf LFS_LDFLAGS)` and `$(getconf LFS_LIBS)`. Thanks for reminding me, I know for UNIX this is not complete yet (for MacOS and Windows it is done already)
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
Ticket change [0a83b0484e] (rid 185646) by jan.nijtmans on 2020-08-21 12:31:23:
- closedate changed to: "2459083.02179825"
- closer changed to: "jan.nijtmans"
- icomment:
Well, until the implementation of [02b58d5d04] is complete, Tcl 9 should continue to use "struct stat64" on 32-bit platforms. Should be fixed now. Thanks!
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Fixed"
- status changed to: "Closed"