Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: d6a0f70292f76e939684979b074f30974c6337045911b9e68c1e2f67ff63a386
Ticket: f7495f63c01ea80069198ac183e1e0cc8873dabe
valgrind reports uninitialized memory access running the test suite
User & Date: sebres on 2026-03-11 15:40:45
Changes

  1. closedate changed to: "2461111.1533021643"
  2. closer changed to: "sebres"
  3. icomment:
    <blockquote>> It has nothing to do with allocation strategy.</blockquote>
    
    I'm agree. However it is indirectly about allocation, see below...
    
    <blockquote>> It's a compiler expectation that (ScriptLimitCallbackKey *) will point to a location with sizeof(ScriptLimitCallbackKey) valid bytes</blockquote>
    
    Nope. The compiler expectation here is to allocate, compare, hash, whatever action with an array of int's, and although it allows so to handle structures in a hash-table, it doesn't do that using structures internally, because the hash-table API considers blocks of int's, nothing else.
    
    So if you want to estimate the impact of the change of Jan, you shall rather consider it as array of ints everywhere. But!..
    
    The fix of Jan may indeed introduce a problem indirectly, since AllocArrayEntry could allocate a block for hash-entry + 3 integers (12 bytes), it can indeed cause many issues at corner case (e. g. ckalloc returns last block matching the range of buffer). And in best case an UB, since casting a struct that requires 16 bytes (due to 4 bytes of trailing padding) to a memory block of only 12 bytes may lead to UB by an attempt to access the struct as a whole or to use it in certain operations.<br/>
    Of course it depends, but in worse case it can be even out-of-bounds memory access (with SF or data corruption), BO on write (in assumed as padding memory), broken array pointer arithmetic etc.
    
    So I am with Ashok here and it shall be rewritten (at least for 64-bit target).
    
  4. login: "sebres"
  5. mimetype: "text/x-fossil-wiki"