Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 59f69ef9c32e9934f03e77274237eb090cead141df8430a7c1a4ef6bf1719dc8
Ticket: 73bb42fb3f35cd613af6fcea465e35bbfd352216
Panic "Buffer Underflow, BUFFER_PADDING not enough"
User & Date: sebres on 2025-03-04 23:08:50
Changes

  1. assignee changed to: "sebres"
  2. closer changed to: "nobody"
  3. icomment:
    Nope, it continues (thus reopened)...
    
    After long research of an issue posted in chat by emiliano (350K large `gitk` over huge repo made boom with BU-panic), I could reduce it to following script, that "successfully" generates the "Buffer Underflow" with current 9.x:
    ```
    set f [open [list | [info nameofexecutable] << {fconfigure stdout -translation binary; puts \xD6[string repeat _ 20]}]]; fconfigure $f -blocking 0 -buffersize 10 -translation lf -eofchar {}; while {![string length [set d [read $f]]]} {after 10}; puts $d; close $f
    ```
    
    After all it is crucial combi of -profile strict, -blocking 0 and -buffersize smaller than read content.<br/>
    In this particular case it reads 20 bytes with buffer 10 bytes (in case of `gitk` read 500K by 4K buffer) with single not utf-8 char inside:
    the "trigger" is `\xD6`-char (`Ö` as single-byte, quasi in "binary" or cp1252 form), what shall cause encoding error in utf-8, but it causes the panic instead.
    
    I'm in, but a bit busy right now, so posting it for the record and when someone could fix it faster than me.
    
    P.S. by the way, because there is no application- or interp-wide option to switch default `-profile` (greetings to all with the opinion "we want no such global configuration facilities"), to be able to use application further, people need to implement ugly mock-ups like this now:
    ```
      rename ::open ::_mckpd_open
      proc ::open args {
        set ch [::_mckpd_open {*}$args]; chan configure $ch -profile tcl8; return $ch
      }
    ```
    (nice, isn't it?)
    
  4. login: "sebres"
  5. mimetype: "text/x-markdown"
  6. priority changed to: "7 High"
  7. resolution changed to: "None"
  8. severity changed to: "Critical"
  9. status changed to: "Open"