Skip to content

anv: Sanitizer fixes

Matt Turner requested to merge mattst88/mesa:sanitizer-fixes into main

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 like memset, memcpy, and qsort (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 where ptr == NULL)

I dislike protecting libc function calls with NULL ptr checks. Hoping for alternative suggestions.

Merge request reports

Loading