Re: [pcre-dev] [PATCH] add malloc and alloc_size attributes …

Kezdőlap
Üzenet törlése
Szerző: Zoltán Herczeg
Dátum:  
Címzett: pcre-dev
Tárgy: Re: [pcre-dev] [PATCH] add malloc and alloc_size attributes to allocation functions
Hi,

I feel this patch just adds unnecessary complexity to the header file. What exactly are these optimizations? For buffer overflows, valgrind is the perfect detection tool with its red zone based detection algorithm. What else can you do with these macros?

Or better to ask: what is your exact use case where you need these features? Perhaps we can suggest some workarounds for them.

Regards,
Zoltan

Nuno Lopes <nunoplopes@???> írta:
>Hi,>
>

Please find in attach a patch to add the malloc and alloc_size >
attributes to PCRE's custom allocation functions.>
The malloc attribute specifies that a given function behaves like >
malloc, and therefore the returned pointer is fresh (i.e., doesn't >
alias anything else). It is used mostly for optimization purposes. (I >
didn't add it to the function pointers, because GCC doesn't support >
that, although clang does).>
The alloc_size attribute specifies that a function allocates memory of >
size given by the set of specified parameters. In PCRE's case, it's >
only the first parameter. This attribute enables some optimizations >
and analysis of buffer overflows and related stuff.>
>

Regards,>
Nuno>
-- >
## List details at https://lists.exim.org/mailman/listinfo/pcre-dev