Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: bf5f854885ababd6c4f648a6c3399be7481a4def2f905b14d32fd753107cab57
Ticket: 0e8fd6c6d5fd2f29f90c6e101197796951e399d6
(unsigned)STRING_SIZE(STRING_MAXCHARS) is 0
User & Date: chrstphrchvz on 2022-03-22 02:10:14
Changes

  1. icomment:
    Just an observation: when built using Clang 13.0.1 AddressSanitizer (<tt>-fsanitize=address</tt>) on macOS, running this example triggers an invalid write in <tt>realloc(ptr, 0)</tt>; the address is just before <tt>ptr</tt>, i.e. likely in the ASAN chunk header, so I wonder if this is an ASAN bug.
    
    <tt>realloc(ptr, 0)</tt> (where <tt>ptr != NULL</tt>) is expected to become undefined behavior in C23, however. Should Tcl try preventing this from happening in e.g. <tt>Tcl_Realloc()</tt>, <tt>ckrealloc()</tt>, etc.?
    
  2. login: "chrstphrchvz"
  3. mimetype: "text/x-fossil-wiki"