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

Sverker Eriksson <>
Wed Apr 6 11:05:09 CEST 2011


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



More information about the erlang-patches mailing list