Overview
| Artifact ID: | 6089758f12b96ae60b829d9d15046a758ac656c5d190bef3f730a902a784f27b |
|---|---|
| Ticket: | 43b434812a6e79e3c5a2e394d57fda75a47af2b6
Tcl 9.0 uses stat64() but not struct stat64 on Linux i686 |
| User & Date: | chrstphrchvz on 2020-08-21 09:28:27 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/x-fossil-wiki"
- comment changed 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 changed to: "9.0"
- 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: "37. File System"
- title changed to:
Tcl 9.0 uses stat64() but not struct stat64 on Linux i686
- type changed to: "Bug"