Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 11dc381be8f1ffd3739cfcab28c689264f8fc49e5fcfe3406541f2f195f7c2a7
Ticket: ab123cfd3d02fb1198f18261c9705e09b4797b99
ValidateFormat(): signed integer overflow
User & Date: chrstphrchvz on 2023-05-02 10:39:56
Changes

  1. closer changed to: "nobody"
  2. icomment:
    Reopening because I would still like for this to be fixed in 8.6 and 8.7.
    
    See attached patch for core-8-6-branch. (For core-8-branch, [3da8d2069c69] can be applied directly along with copying over scan-13.9. But for 8.6, I am not sure anyone would want to bring back compat/strtoull.c, which was removed in 2007.) I agree that storing the result of <tt>strtoul()</tt> in a <tt>signed int</tt> caused several issues, including large arguments being erroneously accepted due to truncation from 64-bit to 32-bit, the comment about <tt>value</tt>/<tt>longval</tt> being “guaranteed to be &gt; 0” not being true, and the signed integer overflow and the scan-13.9 crash.
    
    To clarify, the overflow is detected by UBSan (UndefinedBehaviorSanitizer) rather than ASan (AddressSanitizer); consider revising the check-in message for [787712b4c733] and [3da8d2069c69].
    
    ASan, like Valgrind, is really only useful with <tt>PURIFY</tt> defined. I usually configure with both UBSan and ASan enabled, using <tt>CFLAGS='-DPURIFY -fsanitize=address -fsanitize=undefined' LDFLAGS='-fsanitize=address' ./configure --enable-symbols …</tt> ; I haven’t had to specify <tt>-fsanitize=undefined</tt> in <tt>LDFLAGS</tt> so far. I also apply a workaround for [ac874937c5]. I then usually run with <tt>ASAN_OPTIONS=allocator_may_return_null=1:detect_leaks=0:malloc_context_size=99</tt>.
    
  3. login: "chrstphrchvz"
  4. mimetype: "text/x-fossil-wiki"
  5. resolution changed to: "None"
  6. status changed to: "Open"