Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 6bbea75da82b802b2f315398f8e3a54ac7ecd1dcd73c98449b38ef62fc1730b3
Ticket: 76ad7aeba3e7049e392079c1aea8044d73c0ef17
boundary case bug in [string is integer]
User & Date: jan.nijtmans on 2022-05-22 17:22:53
Changes

  1. assignee changed to: "jan.nijtmans"
  2. icomment:
    Proposed fix [66a187edf25e7d07|here]. Yes, it looks like there - indeed - was a bug in Tcl_GetIntFromObj(), already exposed by testcases get-1.7 up to get-1.14.
    
    The strange thing is that Tcl_GetIntFromObj() is documented to return TCL_OK for values between -(UINT_MAX) and UINT_MAX, while Tcl_GetLongFromObj() is documented to return TCL_OK for values between -(ULONG_MAX) and ULONG_MAX. This means that Tcl_GetLongFromObj() is not usable to check whether the obj can be stored in a (long). Proposed solution:  use TclGetNumberFromObj() to do the range-check first. That's what the compiled code does too ;-)
    
    Please review!  Someone interested to write a bunch of unit-tests?
    
  3. login: "jan.nijtmans"
  4. mimetype: "text/x-fossil-wiki"
  5. resolution changed to: "Fixed"
  6. status changed to: "Pending"