Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 205dc04993406e304d1a574d20c983f7992a523ab3745a67ba7220ab5de0d410
Ticket: 95e287b956e7b1dd2d03729fe27d38574e4f3d12
uninit value use in stringObj-4.2
User & Date: jan.nijtmans on 2023-03-06 20:49:43
Changes

  1. assignee changed to: "jan.nijtmans"
  2. icomment:
    Question: Does core-8-6-branch have the same valgrind issue in the stringObj-4.2 testcase? I suspect it does. If so, it needs to be fixed there first.
    
    What happens is the following:
    
    <pre>
        teststringobj set 1 abcdef
        teststringobj setlength 1 10
    </pre>
    
    So, a string with length 5 is enlarged to length 10. That means that the last 4(!) bytes of the string will be uninitialized. Then:
    
    <pre>
    teststringobj length2 1
    </pre>
    
    So, the internal utf-16 representation of the string is generated, and the utf-16 length of the result is determined. That means that we are generating the utf-16 representation of a partly uninitialized string. Not strange that valgrind conplains!
    
    Proposed solution: Don't run "teststringobj length2" any more for this testcase, in core-8-6-branch, core-8-branch and in trunk.
    
  3. login: "jan.nijtmans"
  4. mimetype: "text/x-fossil-wiki"