Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 934afc3e52adb184e718a39911b52c346c6cdcf181f8ed27a31f431ca9ea8fd2
Ticket: e9a2715d912d86448a2ed18b2d25788cd50769b4
Tcl 8.6.11: Incompatible Tcl_GetRange()
User & Date: petasis on 2022-01-18 14:57:29
Changes

  1. icomment:
    The change in behaviour is caused by this code that was added in 8.6.11:
    
    if (last < first) {
        return Tcl_NewObj();
    }
    
    if last is -1 (or any number < 0), this shortcut will lead directly to an empty string.
    
    But Tcl_New(whatever here)Obj(bytes + first, last - first + 1) will always not return an empty string (with the exception of first being 0, which is a rare use to ask for 0, -1). If last is -1, and first > 0, last - first + 1 will always be negative, so you get back everything till the end of the string.
    
  2. login: "petasis"
  3. mimetype: "text/x-fossil-wiki"