[UBSAN] deltas: Don't call memset(NULL, NULL, 0) with no xattrs
authorColin Walters <walters@verbum.org>
Thu, 17 Nov 2016 18:48:58 +0000 (13:48 -0500)
committerAtomic Bot <atomic-devel@projectatomic.io>
Thu, 17 Nov 2016 19:20:20 +0000 (19:20 +0000)
This is actually fine in practice, but it triggers this
`-fsanitize=undefined` warning I saw in the test suite log:

```
src/libostree/ostree-repo-static-delta-compilation.c:160:10: runtime error: null pointer passed as argument 1, which is declared to never be null
```

Closes: #584
Approved by: jlebon

src/libostree/ostree-repo-static-delta-compilation.c

index 286c74e194b95b1596f214d32994d835a23e67fe..4b0bc507fee448fd74ad2db15f5797a085caeb0d 100644 (file)
@@ -157,6 +157,9 @@ xattr_chunk_equals (const void *one, const void *two)
   if (l1 != l2)
     return FALSE;
 
+  if (l1 == 0)
+    return l2 == 0;
+
   return memcmp (g_variant_get_data (v1), g_variant_get_data (v2), l1) == 0;
 }