terrafx / terrafx.interop.windows

Interop bindings for Windows.
MIT License
242 stars 31 forks source link

[BUG] Fix uninitialized D3D12_RESOURCE_BARRIER flags field #389

Closed paulbartrum closed 3 months ago

paulbartrum commented 3 months ago

The two modified methods (InitAliasing and InitUAV) don't zero initialize the result due to Unsafe.SkipInit(). This makes sense due to the union field (Aliasing) but it means it is possible to accidentally return uninitialized stack memory -- and this is exactly what is happening with the Flags field.