Re: [FFmpeg-devel] [PATCH v2] avutil/mem: Add av_fast_realloc_array()

2019-12-27 Thread Nicolas George
Andreas Rheinhardt (12019-12-26): > I don't understand. Do you think that callers will take this as a blank > cheque to not check at all? No, I mean that using the wrong type will impose limitations on us later, that will take work to resolve. > My intention was actually to convert the types for

Re: [FFmpeg-devel] [PATCH v2] avutil/mem: Add av_fast_realloc_array()

2019-12-26 Thread Andreas Rheinhardt
On Thu, Dec 26, 2019 at 8:35 PM Nicolas George wrote: > Andreas Rheinhardt (12019-12-26): > > b) It guarantees to not allocated more than UINT_MAX - 1 elements, so > > the caller needn't check for overflow if the desired size is increased > > in steps of one. > > This is preparing trouble for lat

Re: [FFmpeg-devel] [PATCH v2] avutil/mem: Add av_fast_realloc_array()

2019-12-26 Thread Nicolas George
Andreas Rheinhardt (12019-12-26): > b) It guarantees to not allocated more than UINT_MAX - 1 elements, so > the caller needn't check for overflow if the desired size is increased > in steps of one. This is preparing trouble for later, and as Michael pointed, it will not work when the number of ele

[FFmpeg-devel] [PATCH v2] avutil/mem: Add av_fast_realloc_array()

2019-12-26 Thread Andreas Rheinhardt
This is an array-equivalent of av_fast_realloc(). Its advantages compared to using av_fast_realloc() for allocating arrays are as follows: a) It performs its own overflow checks for the multiplication that is implicit in array allocations. (And it only needs to perform these checks (as well as the