]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Address Coverity issues.
authorJohn Wolfe <jwolfe@vmware.com>
Tue, 13 Sep 2022 17:31:14 +0000 (10:31 -0700)
committerJohn Wolfe <jwolfe@vmware.com>
Tue, 13 Sep 2022 17:31:14 +0000 (10:31 -0700)
base64.c
- buffer overrun (out); false positive

hashTable.c
- expression always false; false positive

open-vm-tools/lib/misc/base64.c
open-vm-tools/lib/misc/hashTable.c

index ca5ffbfc34edb31dbc0c72077b6a60ad6ad7349b..b54060f1ca531ac6953ed9f01388efb7964c97c2 100644 (file)
@@ -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);
 }
 
index 95abf0ff6f221ee3b2085bbf24fce7149dbbf94d..2cae8d4ca6ae12c2a4150d61506227b85efcd0e0 100644 (file)
@@ -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