Tcl Library Source Code

View Ticket
Login
Ticket UUID: 738736aadb387997879d5e5da8aa42f8f783b717
Title: sha256c: the stubs API declares SHA256Update with size_t len, sha256.c defines it with uint32_t len
Type: Bug Version: trunk
Submitter: serhiy.storchaka Created on: 2026-11-21 12:57:20
Subsystem: sha1 Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Open Last Modified: 2026-11-21 13:19:53
Resolution: None Closed By: nobody
    Closed on:
Description:

Since [0e995fae59] sha256c.tcl declares SHA256Update(..., size_t len) in the critcl API, but sha256.c still defines it as SHA256Update(SHA256Context *sc, const void *data, uint32_t len). Since [d69b5f3fd3] removed the old prototype from sha256.h, no compiler sees both, so the mismatch goes unnoticed. On 64-bit platforms the two types have different sizes, which is undefined behaviour when called through the stubs table. The definition should use size_t (and handle lengths above 4 GiB).

User Comments: serhiy.storchaka added on 2026-11-21 13:19:53:

Proposed fix in branch sha256c-update-size-t. A single call with 4 GiB + 100 bytes now gives the correct hash; before, the length was cut to 100.