Tcl Source Code

View Ticket
Login
Ticket UUID: 1b803e48af8b218f64b9421d5f5be137fa967863
Title: Possible overread in Tcl_ZlibInflate()
Type: Bug Created on: 2026-11-13 14:23:12
Submitter: jan.nijtmans Assigned to: jan.nijtmans
Subsystem: - New Builtin Commands Severity: Important
Priority: 5 Medium Last modified: 2026-11-20 08:02:34
Status: Closed Closed by: jan.nijtmans
Resolution: Fixed Closed on: 2026-11-20 08:02:34
Version: all
Description:

in tclZlib.c, line 1876:

    stream.avail_in = inLen+1; /* +1 because zlib can "over-request"
                                * input (but ignore it!) */

The data buffer is retreived from Tcl_GetBytesFromObj() (line 1808), but the array returned here is NOT generally null-terminated. Is this "+1" really needed? My guess is that it might have been needed in an old (buggy) zlib version, but those kind of bugs are fixed already long ago. We shouldn't do that any more.

Let's see if removing the "+1" breaks anything.

User Comments:
jan.nijtmans added on 2026-11-20 08:02:34:

Merge to [ecb74f661e|trunk], core-9-0-branch and core-8-6-branch