eina hash: imporved safety 22/285022/2
authorPatryk Kaczmarek <patryk.k@partner.samsung.com>
Fri, 2 Dec 2022 13:11:53 +0000 (14:11 +0100)
committerChun <jykeon@samsung.com>
Mon, 5 Dec 2022 04:43:16 +0000 (04:43 +0000)
Change-Id: I49a9d37974c49e5825534bc863e804b4037a2e53

src/lib/eina/eina_hash.c

index d313e57..222e6cb 100644 (file)
@@ -545,6 +545,8 @@ static int
 _eina_int32_key_cmp(const uint32_t *key1, EINA_UNUSED int key1_length,
                     const uint32_t *key2, EINA_UNUSED int key2_length)
 {
+   EINA_SAFETY_ON_NULL_RETURN_VAL(key1, -1);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(key2, -1);
    if (*key1 == *key2) return 0;
    if (*key1 > *key2) return 1;
    return -1;
@@ -560,6 +562,8 @@ static int
 _eina_int64_key_cmp(const uint64_t *key1, EINA_UNUSED int key1_length,
                     const uint64_t *key2, EINA_UNUSED int key2_length)
 {
+   EINA_SAFETY_ON_NULL_RETURN_VAL(key1, -1);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(key2, -1);
    if (*key1 == *key2) return 0;
    if (*key1 > *key2) return 1;
    return -1;