[FFmpeg-devel] [PATCH] avcodec/mov: Allocate skipped_bytes_pos with av_realloc.
michael at niedermayer.cc
Fri Sep 1 13:45:40 EEST 2017
On Thu, Aug 31, 2017 at 02:07:43PM -0400, Mark Wachsler wrote:
> Memory reallocated with av_reallocp_array is supposed to be allocated
> with av_realloc, not av_malloc.
Our docs did briefly claim this but it was removed years ago in
Also FFmpeg has been written with av_realloc*() and av_malloc*()
compatibility in mind both before and after 21f70940ae106bfffa07e73057cdb4b5e81a767a
So its not 2 but many more that likely would need to be changed
If there is a incompatibility then
Its easier to fix the incompatibility between av_malloc* and av_realloc*
also it is much more maintainable if they are compatibile.
Code that works on 99.9 % of the developers systems but breaks on the
remaininng 0.1% is really hard to maintain design.
That said iam not against this patch and i can apply it (without tabs)
if people want but this is far from fixing all these issues
DId you try to replace posix_memalign() by aligned_alloc() where its
ISO C requires aligned_alloc() to be compatibile with realloc()
where one can debate the situation of posix_memalign() and realloc()
7.22.3 Memory management functions
188.8.131.52 The aligned_alloc function
Thus aligned_alloc() is a "Memory management function" in ISO C
In the list of undefined behaviors there is:
- The pointer argument to the free or realloc function does not match a pointer
earlier returned by a memory management function, or the space has been deallocated
by a call to free or realloc (184.108.40.206, 220.127.116.11).
The undefined behavior is clearly limited to pointers not originating
from "Memory management functions", I can see no special case for
In case your implemnatation of aligned_alloc() and realloc() are
incompatibile as well, please fix your implemnatation.
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 181 bytes
Desc: Digital signature
More information about the ffmpeg-devel