Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2022-11-02
13:20 • Closed ticket [00cced7b87]: Incorrect handling of indices > 0x80000000 in byt... artifact: 43fcd6d184 user: jan.nijtmans
13:18
Fix [00cced7b87]: Incorrect handling of indices > 0x80000000 in byte compiler (64-bit Tcl) check-in: 4aad15c2be user: jan.nijtmans tags: trunk, main
02:55 • New ticket [00cced7b87] Incorrect handling of indices > 0x80000000 in byte co... artifact: 3a5bbee679 user: apnadkarni

Incorrect handling of indices > 0x80000000 in byte compiler (64-bit Tcl)

Closed / Fixed00cced7b87a26e570cc5436e386c42225c46dfbaCreated 4 years agoUpdated 4 years ago
Descriptionmarkdown2022-11-02 02:55:34

See the disassembly below:

% tcl::unsupported::disassemble script {lindex $l 0x100000000}
ByteCode 0xffffffffebbdeec8, refCt 1, epoch 20, interp 0xffffffffebb11ca8 (epoch 20)
  Source "lindex $l 0x100000000"
  Cmds 1, src 21, inst 9, litObjs 1, aux 0, stkDepth 1, code/src 0.00
  Commands 1:
      1: pc 0-7, src 0-20
  Command 1: "lindex $l 0x100000000"
    (0) push1 0         # "l"
    (2) loadStk
    (3) listIndexImm -1
    (8) done

Indices > 0x80000000 result in the listIndexImm operand being -1

As an example,

% lindex [lseq 0x100000008] 0x100000000
%

returns an empty string.

Referenced by1
  • 4aad15c2beFix [00cced7b87]: Incorrect handling of indices > 0x80000000 in byte compiler (64-bit Tcl) check-in2022-11-02 13:18:42
jan.nijtmanswiki2022-11-02 13:20:29

Fixed [here]

    % lindex [lseq 0x100000008] 0x100000000
    4294967296

Log in (anonymous is fine) to add a comment.