mesa/src/gallium/frontends
Jose Fonseca e2b044fe3f lavapipe: Prevent integer overflow adding index buffer offset and start index.
Direct3D and Vulkan's robustBufferAccess2 feature mandate that index
buffer out-of-bounds reads should return a zero index (ie, vertex at
index zero, not to be confused with a vertex with zero attributes, as
the kind resulting in vertex buffer out-of-bounds read.)

lavapipe was adding index_offset and start index together without
overflow checks, and if start index was sufficient large (as is the case
with WHCK wgf11draw which sets start index to (UINT)-5) it would cause
to wrap around causing fetches that should be out of bounds wrap around
and fetch inside bounds.

This change fixes this by doing a clamped add.  This ensures start index
is set to UINT32_MAX on overflow, which is sufficient in practice to
trigger draw index OOB code-paths, yield zero index to be returned.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19683>
2022-11-14 23:00:03 +00:00
..
clover clover: Fixes building with mingw-x86 2022-11-11 05:38:20 +00:00
d3d10umd mesa: Use DEBUG_NAMED_VALUE_END for const struct debug_named_value 2022-11-03 14:40:33 +00:00
dri kopper: guard unused variable behind ifdef 2022-11-14 20:13:20 +00:00
glx/xlib util: Remove os/os_thread.h and replace #include "os/os_thread.h" with #include "util/u_thread.h" 2022-11-08 05:21:42 +00:00
hgl util: Remove os/os_thread.h and replace #include "os/os_thread.h" with #include "util/u_thread.h" 2022-11-08 05:21:42 +00:00
lavapipe lavapipe: Prevent integer overflow adding index buffer offset and start index. 2022-11-14 23:00:03 +00:00
nine util: Remove os/os_thread.h and replace #include "os/os_thread.h" with #include "util/u_thread.h" 2022-11-08 05:21:42 +00:00
omx util: Remove os/os_thread.h and replace #include "os/os_thread.h" with #include "util/u_thread.h" 2022-11-08 05:21:42 +00:00
osmesa st: Remove struct st_api, st_gl_api_create and st_gl_api.h 2022-10-24 11:31:20 +00:00
rusticl rusticl: make image format/order work on radeonsi 2022-11-10 10:21:34 +00:00
va frontends/va: fixed av1 decoding 10bit ffmpeg output YUV issue 2022-11-14 22:19:53 +00:00
vdpau util: Remove os/os_thread.h and replace #include "os/os_thread.h" with #include "util/u_thread.h" 2022-11-08 05:21:42 +00:00
wgl zink: Only #include <vulkan/vulkan_core.h> instead #include <vulkan/vulkan.h> in kopper_interface.h 2022-11-10 06:59:42 +00:00
xa gallium: normalized_coords -> unnormalized_coords 2022-10-10 10:20:02 +00:00