Skip to content

UBSAN failure when storing a negative color channel into a unorm8 texture format #611

Closed

Description

@solidpixel

The current decompressor has orthogonal handling of the internal format (LDR, HDR) and the output pixel format. It is therefore possible to store an HDR texture, which can represent values outside of the [0.0-1.0] range, into a UNORM8 output. The intent is that we can store [0.0 - 1.0] float range in the data, mapping it into the [0-255] uint8 range used by a unorm texture, clamping values outside of that to the limits.

The current code clamps the max value to 255, but does not clamp the lower limit to 0. This works for normal ASTC blocks, as the LNS encoding use for HDR values cannot represent negative values, but the HDR void-extent blocks use a raw FP16 color that can be negative. In this situation the color value stored will be incorrect.

Found by OSS-Fuzz.

Activity

  1. added a commit that references this issue on May 7, 2026
    0be4954
  2. self-assigned this
    on May 7, 2026
  3. added 3 commits that reference this issue on May 7, 2026
    500c10e
    840d3c7
    fb43f0e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions