Skip to content

gvariant, gbytes: Avoid memcmp (NULL, ., 0) or memcmp (., NULL, 0)

Simon McVittie requested to merge wip/smcv/memcmp-null into master

Similar to 3837b83f, glibc memcmp is declared with the first two arguments annotated as non-null via an attribute, which results in the undefined behaviour sanitizer considering it to be UB to pass a null pointer there (even if we are comparing 0 bytes, and hence not actually dereferencing the pointer).

This shows up in /gvariant/serialiser/children when run with the undefined behaviour sanitizer.

Merge request reports