{d3d8,d3d9}/tests: Increase size of quad array to avoid buffer overflow (ASan).
Inside d3d*_device_DrawPrimitiveUP,
with primitive_type D3DPT_TRIANGLELIST,
the buffer is expected to have a size of primitive_count * 3 * stride.
The test uses sizeof(quad), which gets changed by this patch, but I am not sure if the test was written specifically with the current size of the variable quad?
Testbot run with this patch, d3d8
ASan report details, d3d8
=================================================================
==392==ERROR: AddressSanitizer: global-buffer-overflow on address 0x0001400f15d0 at pc 0x6ffffe8dc03b bp 0x7ffffe1fed70 sp 0x7ffffe1fedb8
READ of size 96 at 0x0001400f15d0 thread T0
#0 0x6ffffe8dc03a in __asan_memcpy /home/runner/work/llvm-mingw/llvm-mingw/llvm-project/compiler-rt/lib/asan/asan_interceptors_memintrinsics.cpp:65:3
#1 0x6ffff97c7abb in wined3d_streaming_buffer_upload .../wine/dlls/wined3d/buffer.c:1438
#2 0x6ffffddd0f7f in d3d8_device_DrawPrimitiveUP .../wine/dlls/d3d8/device.c:2688
#3 0x000140059d09 in test_draw_primitive .../wine/dlls/d3d8/tests/device.c:10400
#4 0x00014000148b in func_device .../wine/dlls/d3d8/tests/device.c:11167
#5 0x0001400d5de2 in run_test .../wine/include/wine/test.h:780
#6 0x0001400d57eb in main .../wine/include/wine/test.h:900
#7 0x0001400d7aba in mainCRTStartup .../wine/dlls/msvcrt/crt_main.c:62
#8 0x6fffffc67a74 in BaseThreadInitThunk (C:\windows\system32\kernel32.dll+0x178027a74)
#9 0x6fffffde06a6 in RtlUserThreadStart (C:\windows\system32\ntdll.dll+0x1700506a6)
0x0001400f15d0 is located 48 bytes before global variable 'test_draw_primitive.indices' defined in '.../wine/dlls/d3d8/tests/device.c:10330' (0x0001400f1600) of size 12
0x0001400f15d0 is located 0 bytes after global variable 'test_draw_primitive.quad' defined in '.../wine/dlls/d3d8/tests/device.c:10322' (0x0001400f1580) of size 80
SUMMARY: AddressSanitizer: global-buffer-overflow .../wine/dlls/wined3d/buffer.c:1438 in wined3d_streaming_buffer_upload
Testbot run with this patch, d3d9
ASan report details, d3d9
=================================================================
==1056==ERROR: AddressSanitizer: global-buffer-overflow on address 0x0001401df220 at pc 0x6ffffe8dc03b bp 0x7ffffe1fed10 sp 0x7ffffe1fed58
READ of size 96 at 0x0001401df220 thread T0
#0 0x6ffffe8dc03a in __asan_memcpy /home/runner/work/llvm-mingw/llvm-mingw/llvm-project/compiler-rt/lib/asan/asan_interceptors_memintrinsics.cpp:65:3
#1 0x6ffff97c7abb in wined3d_streaming_buffer_upload .../wine/dlls/wined3d/buffer.c:1438
#2 0x6ffffdd4519d in d3d9_device_DrawPrimitiveUP .../wine/dlls/d3d9/device.c:3345
#3 0x000140050b68 in test_draw_primitive .../wine/dlls/d3d9/tests/device.c:3222
#4 0x000140030097 in func_device .../wine/dlls/d3d9/tests/device.c:15356
#5 0x0001401ba1f2 in run_test .../wine/include/wine/test.h:780
#6 0x0001401b9bfb in main .../wine/include/wine/test.h:900
#7 0x0001401bbeca in mainCRTStartup .../wine/dlls/msvcrt/crt_main.c:62
#8 0x6fffffc67a74 in BaseThreadInitThunk (C:\windows\system32\kernel32.dll+0x178027a74)
#9 0x6fffffde06a6 in RtlUserThreadStart (C:\windows\system32\ntdll.dll+0x1700506a6)
0x0001401df220 is located 32 bytes before global variable 'test_draw_primitive.indices' defined in '.../wine/dlls/d3d9/tests/device.c:3100' (0x0001401df240) of size 12
0x0001401df220 is located 0 bytes after global variable 'test_draw_primitive.quad' defined in '.../wine/dlls/d3d9/tests/device.c:3093' (0x0001401df1e0) of size 64
SUMMARY: AddressSanitizer: global-buffer-overflow .../wine/dlls/wined3d/buffer.c:1438 in wined3d_streaming_buffer_upload