Skip to content

Clarification on deferUpdateTime practical range (integer overflow warning in libvncserver/main.c lines 1270, 1372) #701

@Rakhmatula

Description

@Rakhmatula

Hi team,

Static analysis flagged a potential integer overflow in libvncserver/main.c (lines 1270, 1372) in version 0.9.14:

if(usec < 0)
    usec = screen->deferUpdateTime * 1000;

Here deferUpdateTime is int, usec is long.

Theoretically, overflow occurs when deferUpdateTime >= 2,147,484 ms (since int overflow happens before the result is assigned to long).

Based on the documentation and typical usage, deferUpdateTime stores milliseconds, and normally takes values like 20–40 ms (deferred screen update interval). However, I'd like to understand:

What is the maximum practical value that deferUpdateTime can actually have in real-world usage? Are there any legitimate scenarios where it could reach, say, minutes or hours (e.g., special configurations, slow links, or edge cases)?

This will help determine whether the static analysis warning is a false positive or something that genuinely needs fixing (e.g., by casting to long before multiplication: usec = screen->deferUpdateTime * 1000L).

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions