Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: a5073e50210fc85a0c796364a506808d22fc704a
Ticket: 1813528fffffffffffffffffffffffffffffffff
off-by-one error in parser unbalanced brace in comment check
User & Date: mistachkin on 2007-10-15 05:34:10
Changes

  1. assignee changed to: "msofer"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    
    This bug is present in both 8.4 and 8.5 (HEAD).
    
    In Tcl_ParseBraces, near line 1671 in HEAD we see:
    
    src = start;
    
    A couple lines later, src is updated in a loop:
    
    while (++src, --numBytes) {
    <snip>
    
    If this loop terminates due to numBytes being zero, src may point one character beyond the end of the string.
    
    The real problem arises in the error handling code that attempts to search backwards for the open brace inside of a comment, near line 1788:
    
    for (; src > start; src--) {
        switch (*src) {
    <snip>
    
    At the point the switch statement is executed, src still may point one character beyond the end of the string.
    
    A possible fix for this issue is to change the loop as follows:
    
    for (src--; src > start; src--) {
        switch (*src) {
    <snip>
    
    
  4. foundin changed to: "obsolete: 8.5b1"
  5. is_private changed to: "0"
  6. priority changed to: "5 Medium"
  7. resolution changed to: "None"
  8. status changed to: "Open"
  9. submitter changed to: "mistachkin"
  10. subsystem changed to: "45. Parsing and Eval"
  11. title changed to:
    off-by-one error in parser unbalanced brace in comment check
    
  12. type changed to: "Bug"