Skip to content

Remote Code Execution Vulnerability via custom-crafted image file

Critical
walbourn published GHSA-677v-7wfg-cg4f Sep 9, 2020

Package

DirectXTex

Affected versions

July 3, 2018 or earlier

Patched versions

August 5, 2018 or later

Description

Impact

The DDS codec did not properly guard against width/height combinations that could overflow a 32-bit unsigned integer byte count when computing image size.

Patches

In the August 5, 2018 version when support for 16k textures was added, this issue was fixed as a side-effect.

Workarounds

The changes in this commit could be pulled back to your version.

Notes

This issue does not impact DDSTextureLoader or WICTextureLoader because those used maximum bounds based on the Direct3D hardware limitations that generally prevents this overflow. DirectXTex was allowed to handle larger files to provide support for resizing them down to supported limitations.

For additional hardening of the DirectXTex library, the August 15, 2020 release includes this commit to default to applying the same limitations as DDSTextureLoader for size unless the DDS_FLAGS_ALLOW_LARGE_FILES flag is provided (i.e. opt-in support for tools).

References

Applies to both CVE-2020-16856 and CVE-2020-16874.

Severity

Critical

CVE ID

CVE-2020-16856

Weaknesses

No CWEs