Closed Said6289 closed 1 month ago
I made fixes to GL and vulkan speculatively to handle this case, though on vulkan I wasn't able to successfully capture anything that needed >4GB and AFAIK allocations over 4GB are not supported on D3D at all so I didn't make any changes there. In theory this should work but it will likely depend heavily on OS/driver support at this point.
Description
The function
GetByteSize
inrenderdoc/driver/gl/gl_resources.cpp
accepts threeGLsizei
argumentsw
,h
, andd
. The subexpressionw * d * h
is found in multiple places in the function and its result is undefined if the product overflows since these are 32-bit signed integers. I suspect the same problem exists inGetCompressedByteSize
.Steps to reproduce
In my case I have single channel half float 3D texture that's 1024x1024x3072 which is 6 GiB in size and does not fit in a signed 32 bit number. Any capture that involves this resource causes the subprocess to crash due to the computed
size
being the result of undefined behavior as far as I can tell. Simply storingw
,h
, andd
insize_t
local variables results in a correct calculation and fixes the crash.Environment