Skip to content

Avoid shifting by 32 or more in interpretDFD - #32

Merged
MarkCallow merged 1 commit into
KhronosGroup:mainfrom
armatti:interpretdfd-bitlength
Oct 29, 2026
Merged

MarkCallow merged 1 commit into
KhronosGroup:mainfrom
armatti:interpretdfd-bitlength

Conversation

@armatti

@armatti armatti commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

The BITLENGTH field holds the bit length minus 1, so 1U << BITLENGTH is undefined for samples of 32 bits or more, such as those of the R64 integer formats and block-compressed formats.

Clamp the bit length to 32. The spec's extension of sampleUpper for longer samples gives the same result as comparing at 32 bits.

Found by fuzzing KTX-Software with libFuzzer. Fixes #31.

The BITLENGTH field holds the bit length minus 1, so 1U << BITLENGTH is
undefined for samples of 32 bits or more, such as those of the R64
integer formats and block-compressed formats.

Clamp the bit length to 32. The spec's extension of sampleUpper for
longer samples gives the same result as comparing at 32 bits.

Found by fuzzing KTX-Software with libFuzzer. Fixes KhronosGroup#31.
@CLAassistant

CLAassistant commented Oct 28, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@MarkCallow
MarkCallow merged commit a3143c1 into KhronosGroup:main Oct 29, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

interpretDFD: undefined shift for valid 64-bit and block-compressed formats

3 participants