From: John Wolfe Date: Tue, 13 Sep 2022 17:31:14 +0000 (-0700) Subject: Address Coverity issues. X-Git-Tag: stable-12.2.0~97 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1dbbb6e91e5388a88fe063d61d0cbb9602fb75a1;p=thirdparty%2Fopen-vm-tools.git Address Coverity issues. base64.c - buffer overrun (out); false positive hashTable.c - expression always false; false positive --- diff --git a/open-vm-tools/lib/misc/base64.c b/open-vm-tools/lib/misc/base64.c index ca5ffbfc3..b54060f1c 100644 --- a/open-vm-tools/lib/misc/base64.c +++ b/open-vm-tools/lib/misc/base64.c @@ -350,6 +350,8 @@ Base64_Decode(char const *in, // IN: size_t outSize, // IN: size_t *dataLength) // OUT: { + /* -1 is properly handled in the Base64_ChunkDecode method. */ + /* coverity[overrun-buffer-arg:FALSE] */ return Base64_ChunkDecode(in, -1, out, outSize, dataLength); } diff --git a/open-vm-tools/lib/misc/hashTable.c b/open-vm-tools/lib/misc/hashTable.c index 95abf0ff6..2cae8d4ca 100644 --- a/open-vm-tools/lib/misc/hashTable.c +++ b/open-vm-tools/lib/misc/hashTable.c @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2004-2017 VMware, Inc. All rights reserved. + * Copyright (C) 2004-2022 VMware, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -148,6 +148,12 @@ HashTableComputeHash(const HashTable *ht, // IN: hash table if (sizeof s == 4) { h = (uint32) (uintptr_t) s; } else { + /* + * Coverity warns that s >> 32 will always equate to 0 regardless of + * what s may be. This is true when uintptr_t is 32 bits, but + * not when it is 64 bit. + */ + /* coverity[result_independent_of_operands] */ h = (uint32) (uintptr_t) s ^ (uint32) ((uint64) (uintptr_t) s >> 32); } h *= 48271; // http://www.google.com/search?q=48271+pseudorandom