diff options
author | Jo-Philipp Wich <jo@mein.io> | 2021-07-27 20:51:43 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2021-07-27 20:51:43 +0200 |
commit | d49af4eb9b111442b4e4fce56a154fb8f27c9b5d (patch) | |
tree | e644d8fefb0fd52981b62702c4b60a42e55393f0 /types.c | |
parent | c79ff390fa4696543057a25ea7bf93c7775652f5 (diff) |
types: fix comparison of differently signed integers
Fixes: c79ff39 ("types: handle conversion errors when dealing with negative error indexes")
Fixes: 3315b1f ("types: allow negative array indexes")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'types.c')
-rw-r--r-- | types.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1980,7 +1980,7 @@ ucv_key_get(uc_vm_t *vm, uc_value_t *scope, uc_value_t *key) if (ucv_type(scope) == UC_ARRAY) { idx = ucv_key_to_index(key); - if (idx < 0 && idx > INT64_MIN && llabs(idx) <= ucv_array_length(scope)) + if (idx < 0 && idx > INT64_MIN && (uint64_t)llabs(idx) <= ucv_array_length(scope)) idx += ucv_array_length(scope); if (idx >= 0 && (uint64_t)idx < ucv_array_length(scope)) @@ -2017,7 +2017,7 @@ ucv_key_set(uc_vm_t *vm, uc_value_t *scope, uc_value_t *key, uc_value_t *val) if (ucv_type(scope) == UC_ARRAY) { idx = ucv_key_to_index(key); - if (idx < 0 && idx > INT64_MIN && llabs(idx) <= ucv_array_length(scope)) + if (idx < 0 && idx > INT64_MIN && (uint64_t)llabs(idx) <= ucv_array_length(scope)) idx += ucv_array_length(scope); if (idx < 0 || !ucv_array_set(scope, idx, val)) |