[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Fix implicit signed to unsigned conversion in PVM_VAL_BOX
From: |
Tim Rühsen |
Subject: |
Re: [PATCH] Fix implicit signed to unsigned conversion in PVM_VAL_BOX |
Date: |
Fri, 10 Apr 2020 20:35:41 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 |
Pushed.
On 10.04.20 20:01, Jose E. Marchesi wrote:
>
> Hi Tim.
>
> Found by libFuzzer:
> pvm-program.c:74:11: runtime error: implicit conversion from type 'int' of
> value -8 (32-bit, signed) to type 'unsigned long' changed the value to
> 18446744073709551608 (64-bit, unsigned)
>
> OK for master.
> Thanks!
>
> 2020-04-10 Tim Rühsen <address@hidden>
>
> * lib/pvm.h (PVM_VAL_BOX): Fix implicit signed
> to unsigned conversion.
> ---
> ChangeLog | 5 +++++
> lib/pvm.h | 2 +-
> 2 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/lib/pvm.h b/lib/pvm.h
> index 3fbb513b..e1a06d65 100644
> --- a/lib/pvm.h
> +++ b/lib/pvm.h
> @@ -143,7 +143,7 @@ pvm_val pvm_make_ulong (uint64_t value, int size);
> all pointers are aligned to 8 bytes. The allocator for the boxed
> values makes sure this is always the case. */
>
> -#define PVM_VAL_BOX(V) ((pvm_val_box) ((((uintptr_t) V) & ~0x7)))
> +#define PVM_VAL_BOX(V) ((pvm_val_box) ((((uintptr_t) V) & ~0x7U)))
>
> /* This constructor should be used in order to build boxes. */
>
> --
> 2.26.0
>
signature.asc
Description: OpenPGP digital signature