Skip to content

Commit 0397313

Browse files
authored
Zero DDS header reserved2 field (#654)
When writing uncompressed DDS files the current code does not initialize the reserved2 field, so it contains random stack data. This change zeros reserved2 before writing it.
1 parent af7190c commit 0397313

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

Docs/ChangeLog-5x.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ clocked at 4.2 GHz, running `astcenc` using AVX2 and 6 threads.
1414
The 5.6.0 release is a minor maintenance release.
1515

1616
* **Command line tool updates:**
17+
* **Bug fix:** Zero the trailing reserved field of the DDS header before
18+
writing it, so uncompressed `.dds` output no longer contains uninitialized
19+
stack bytes.
1720
* **Bug fix:** Fixed incorrect plane stride when writing an uncompressed 3D
1821
LDR image to a DDS container.
1922
* **Bug fix:** Fixed potential integer overflow when storing very large

Source/astcenccli_image_load_store.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2249,6 +2249,7 @@ static bool store_dds_uncompressed_image(
22492249
hdr.caps2 = (dim_z > 1) ? 0x200000 : 0;
22502250
hdr.caps3 = 0;
22512251
hdr.caps4 = 0;
2252+
hdr.reserved2 = 0;
22522253

22532254
// Pixel-format data
22542255
if (bitness == 8)

0 commit comments

Comments
 (0)