• Edward Catmur's avatar
    Avoid passing null to memcpy/memcmp/memset · dbc088d1
    Edward Catmur authored
    It is invalid to pass null as a pointer argument to memcpy/memcmp/memset, even if the count argument is zero:
    
    > Where an argument declared as size_t n specifies the length of the array for a
    function, n can have the value zero on a call to that function. Unless explicitly stated
    otherwise in the description of a particular function in this subclause, pointer arguments
    on such a call shall still have valid values [...]
    
    Detected by -fsanitize=nonnull-attribute.
    dbc088d1
serialize-packed-test.c++ 18.2 KB