From: Colin Walters Date: Thu, 17 Nov 2016 18:48:58 +0000 (-0500) Subject: [UBSAN] deltas: Don't call memset(NULL, NULL, 0) with no xattrs X-Git-Tag: archive/raspbian/2022.1-3+rpi1~1^2~4^2~43^2~13 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=b5c4e6d99ac0dc5e9aa20cabdb7208b11e7b6966;p=ostree.git [UBSAN] deltas: Don't call memset(NULL, NULL, 0) with no xattrs 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 --- diff --git a/src/libostree/ostree-repo-static-delta-compilation.c b/src/libostree/ostree-repo-static-delta-compilation.c index 286c74e1..4b0bc507 100644 --- a/src/libostree/ostree-repo-static-delta-compilation.c +++ b/src/libostree/ostree-repo-static-delta-compilation.c @@ -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; }