Matteo Bruni (@Mystral) commented about dlls/d3dx9_36/surface.c:
+ uint16_t xorigin; + uint16_t yorigin; + uint16_t width; + uint16_t height; + uint8_t depth; + uint8_t image_descriptor; +}; +#include "poppack.h" + +static HRESULT d3dx_initialize_image_from_tga(const void *src_data, uint32_t src_data_size, struct d3dx_image *image) +{ + const struct tga_header *header = (src_data_size >= sizeof(*header)) ? (const struct tga_header *)src_data : NULL; + uint32_t expected_header_size = sizeof(*header); + + if (!header) + return D3DXERR_INVALIDDATA; I think it's cleaner to unconditionally assign `src_data` to `header` and move the check directly to the `if`.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/6673#note_85144