Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Integer Overflow in qcow_make_empty() for CWE-190 #10

Open
@ybdesire

Description

Description

The function qcow_make_empty() contains an integer overflow vulnerability (CWE-190) due to unsafe 32-bit multiplication when calculating the L1 table size. The calculation s->l1_size * sizeof(uint64_t) uses:

uint32_t l1_length = s->l1_size * sizeof(uint64_t);

l1_size declared as unsigned int (typically 32-bit)

sizeof(uint64_t) = 8 (fixed size)

If l1_size ≥ 0x20000000 (536,870,912), the multiplication result exceeds UINT32_MAX (4,294,967,295), causing uint32_t l1_length to wrap around to 0 (since 536,870,912 ×ばつ 8 = 4,294,967,296 ≡ 0 mod 232).

This corrupted l1_length is passed to bdrv_truncate(), truncating the data at s->l1_table_offset (instead of the valid end position s->l1_table_offset + actual_L1_size).

Impact

The vulnerability exists in latest main branch:

https://github.com/coldfunction/qCUDA/blob/master/qcu-device/block/qcow.c#L1038

All versions with this code remain vulnerable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /