Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 0e7b0825822d2386ca52c7fc881ab807c9f461743f8d486b01c0189c37c69596
Ticket: 73bb42fb3f35cd613af6fcea465e35bbfd352216
Panic "Buffer Underflow, BUFFER_PADDING not enough"
User & Date: apnadkarni on 2025-01-14 11:23:18
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/x-markdown"
  4. comment changed to:
    Following script causes the panic quoted in the subject line (9.0.0, 9.0.1, trunk)
    
    ```
    set buffersize 8
    writeFile crasher.txt binary [string repeat x [expr $buffersize-1]]\r\xe9XXXXXXXXXXXXXXXXXXXXXXXX
    set fd [open crasher.txt]
    fconfigure $fd -encoding utf-8 -buffersize $buffersize -translation crlf
    catch {read $fd [expr $buffersize+1]} e; # (Correctly) raises encoding error
    puts $e
    close $fd
    set fd [open crasher.txt]
    fconfigure $fd -encoding utf-8 -buffersize $buffersize -translation crlf
    read $fd $buffersize; # <- Panic
    ```
    
    Note the crash *seems* to only happen when the CR is at the buffer edge *and* the iso8859-1 encoding is read as utf-8. Otherwise, an encoding error is correctly raised. However, I'm not sure what other circumstances would cause the same effect.
    
  5. foundin changed to: "9.0.0"
  6. is_private changed to: "0"
  7. login: "apnadkarni"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "9546e9877f1a8899e25a89082561ee694e7fb402"
  10. resolution changed to: "None"
  11. severity changed to: "Important"
  12. status changed to: "Open"
  13. submitter changed to: "apnadkarni"
  14. subsystem changed to: "- New Builtin Commands"
  15. title changed to:
    Panic "Buffer Underflow, BUFFER_PADDING not enough"
    
  16. type changed to: "Bug"