CVE-2024-36618: C Int64 Increment Signed Overflow

Using an undersized literal (like `1LU`) to increment an `int64_t` variable tracking towards `INT64_MAX` produces undefined behavior. On platforms where `ULONG_MAX < INT64_MAX` (e.g., Windows LLP64), `1LU` acts as a 32-bit unsigned entity, natively coercing the operation into a signed 64-bit addition instead of unsigned. This causes a signed integer overflow

Provally CuratedPublic repositoryMediumMedium confidenceVerifiedApache-2.0Cβ
greprules fetch cve-2024-36618-c-int64-increment-signed-overflow --engine opengrep

Description

Using an undersized literal (like `1LU`) to increment an `int64_t` variable tracking towards `INT64_MAX` produces undefined behavior. On platforms where `ULONG_MAX < INT64_MAX` (e.g., Windows LLP64), `1LU` acts as a 32-bit unsigned entity, natively coercing the operation into a signed 64-bit addition instead of unsigned. This causes a signed integer overflow