On 9/19/26 13:37, Roman Bogorodskiy wrote:
The Ubuntu clang CI build currently fails on genericxml2xmltest with:
../src/util/virbitmap.c:590:12: runtime error: null pointer passed as argument 1, which is declared to never be null /usr/include/string.h:48:28: note: nonnull attribute specified here
Which is happening on memcpy() in virBitmapNewCopy(). This happens when copying a zero-sized bitmap.
Fix by calling memcpy() only when the source and destination bitmaps are not zero-sized.
Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com> --- src/util/virbitmap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c index 78545501b7..b75ba61a99 100644 --- a/src/util/virbitmap.c +++ b/src/util/virbitmap.c @@ -587,7 +587,8 @@ virBitmapNewCopy(virBitmap *src) { virBitmap *dst = virBitmapNew(src->nbits);
- memcpy(dst->map, src->map, dst->map_len * sizeof(src->map[0])); + if (dst->map && src->map) + memcpy(dst->map, src->map, dst->map_len * sizeof(src->map[0]));
return dst; }
This fixes just one API. There are few others that need similar treatment. I've posted a patch for that (started writing it on Friday when I saw failed pipeline, but of course went home earlier). Michal