[erlang-patches] Re: [PATCH] efile_drv: unsigned integer may overflow in error message

Michael Santos michael.santos@REDACTED
Wed Apr 6 20:52:26 CEST 2011


On Wed, Apr 06, 2011 at 11:05:09AM +0200, Sverker Eriksson wrote:
> Michael Santos wrote:
>> ---
>>  erts/emulator/drivers/common/efile_drv.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/erts/emulator/drivers/common/efile_drv.c b/erts/emulator/drivers/common/efile_drv.c
>> index 4e9b500..6e62342 100644
>> --- a/erts/emulator/drivers/common/efile_drv.c
>> +++ b/erts/emulator/drivers/common/efile_drv.c
>> @@ -410,7 +410,7 @@ struct t_data
>>  static void *ef_safe_alloc(Uint s)
>>  {
>>      void *p = EF_ALLOC(s);
>> -    if (!p) erl_exit(1, "efile drv: Can't allocate %d bytes of memory\n", s);
>> +    if (!p) erl_exit(1, "efile drv: Can't allocate %u bytes of memory\n", s);
>>      return p;
>>  }
>>    
> May still overflow on 64-bit.
>
> %lu bytes of memory\n", (unsigned long)s);
>
>
> won't.
>
> /Sverker

Thanks! I see now that "Uint" is typedef'ed to "unsigned long" on
64-bit. I will resend the patch!



More information about the erlang-patches mailing list