anv: Sanitizer fixes
While trying to debug another issue I enabled -Db_sanitize="address,undefined
in my build and discovered a handful of sanitizer errors from running dEQP. I haven't been able to run dEQP to completion due to #12145 (closed), so these fixes might be incomplete.
They break down into a few categories, all of which are undefined behavior:
- passing
NULL
to libc functions likememset
,memcpy
, andqsort
(and presumably expecting them to do nothing in that case) - pointer aliasing leading to unaligned accesses
- referencing/offsetting a null pointer (e.g.
&ptr->field
whereptr == NULL
)
I dislike protecting libc function calls with NULL ptr checks. Hoping for alternative suggestions.