mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-29 21:00:16 +01:00
gallium: Avoid nullptr-with-nonzero-offset
reserve() in rtasm_x86sse compares a pointer difference with some integers to check if reallocation is needed. It unfortunately groups the first pointer with an int, which makes it possible to hit nullptr-with-nonzero-offset under Undefined Behavior Sanitizer. This patch suggests a reordering of the arithmetic expression so that first the pointer difference is computed, and from that on it's just a usual integer arithmetic, avoiding nullptr-with-nonzero-offset. Reviewed-by: Emma Anholt <emma@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18522>
This commit is contained in:
parent
cdbb30334c
commit
5bde671df2
1 changed files with 1 additions and 1 deletions
|
|
@ -174,7 +174,7 @@ static void do_realloc( struct x86_function *p )
|
|||
*/
|
||||
static unsigned char *reserve( struct x86_function *p, int bytes )
|
||||
{
|
||||
if (p->csr + bytes - p->store > (int) p->size)
|
||||
if (p->csr - p->store + bytes > (int) p->size)
|
||||
do_realloc(p);
|
||||
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue