ssh: fix infinite loop on large channel writes due to integer overflow The internal 'min' helper function in channel.go incorrectly cast the input data length (int) to uint32 before comparing it with the maximum packet size. On 64-bit systems, if the data length is a multiple of 2^32 (approx. 4GB), this cast results in 0. Consequently, the function returns 0, causing the WriteExtended loop to spin indefinitely because it attempts to reserve 0 bytes while the remaining data length is still positive. This change renames the helper to 'minPayloadSize' to avoid confusion with the Go 1.21 built-in 'min' and updates the logic to use int64 for comparisons, preventing truncation and the resulting infinite loop. This issue was found during a security audit by NCC Group Cryptography Services, sponsored by Teleport. Fixes golang/go#79567 Fixes CVE-2026-39834 Change-Id: Id5bf81d9f06c7042452acffe1c76580ff878665e Reviewed-on: https://go-review.googlesource.com/c/crypto/+/781663 Reviewed-by: Neal Patel <nealpatel@google.com> Reviewed-by: Roland Shoemaker <roland@golang.org> LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This repository holds supplementary Go cryptography packages.
This repository uses Gerrit for code changes. To learn how to submit changes to this repository, see https://go.dev/doc/contribute.
The git repository is https://go.googlesource.com/crypto.
The main issue tracker for the crypto repository is located at https://go.dev/issues. Prefix your issue with “x/crypto:” in the subject line, so it is easy to find.
Note that contributions to the cryptography package receive additional scrutiny due to their sensitive nature. Patches may take longer than normal to receive feedback.