CVE-2026-21507: Infinite Loop Missing Read Zero Check

A loop decrements its counter by the result of a read operation without checking if the read returned 0. If the read fails or reaches end-of-file (EOF), it may return 0, causing the loop counter to never reach 0 and resulting in an infinite loop (Denial of Service). Ensure there is a break or return condition that asserts the read payload length is greater t

Provally CuratedPublic repositoryMediumMedium confidenceVerifiedApache-2.0C++
greprules fetch cve-2026-21507-infinite-loop-missing-read-zero-check --engine opengrep

Description

A loop decrements its counter by the result of a read operation without checking if the read returned 0. If the read fails or reaches end-of-file (EOF), it may return 0, causing the loop counter to never reach 0 and resulting in an infinite loop (Denial of Service). Ensure there is a break or return condition that asserts the read payload length is greater t