[FFmpeg-devel] [PATCH 1/4] lavu: add simple array implementation

Michael Niedermayer michaelni at gmx.at
Thu Mar 20 05:58:29 CET 2014


On Thu, Mar 13, 2014 at 02:07:29AM +0100, Michael Niedermayer wrote:
> On Wed, Mar 12, 2014 at 03:34:41PM +0100, Lukasz M wrote:
> > On 12 March 2014 15:21, Lukasz M <lukasz.m.luki at gmail.com> wrote:
> > 
> > > On 9 March 2014 17:04, Michael Niedermayer <michaelni at gmx.at> wrote:
> > >
> > >> On Thu, Mar 06, 2014 at 11:03:09PM +0100, Lukasz Marek wrote:
> > >> > On 06.03.2014 03:06, Michael Niedermayer wrote:
> > >> > >On Wed, Mar 05, 2014 at 07:34:35PM +0100, Nicolas George wrote:
> > >> > >>Le quintidi 15 ventôse, an CCXXII, wm4 a écrit :
[...]
> > Signed-off-by: Lukasz Marek <lukasz.m.luki at gmail.com>
> > ---
> >  libavutil/mem.c |   13 +++++++++++++
> >  libavutil/mem.h |   19 +++++++++++++++++--
> >  2 files changed, 30 insertions(+), 2 deletions(-)
> > 
> > diff --git a/libavutil/mem.c b/libavutil/mem.c
> > index 7206ddc..b9b5742 100644
> > --- a/libavutil/mem.c
> > +++ b/libavutil/mem.c
> > @@ -278,6 +278,19 @@ void *av_memdup(const void *p, size_t size)
> >      return ptr;
> >  }
> >  
> > +int av_dynarray_add_nofree(void *tab_ptr, int *nb_ptr, void *elem)
> > +{
> 
> > +    intptr_t *tab = *(intptr_t**)tab_ptr;
> 
> undefined behavior (strict aliasing violation)

Note, AFAIK you can avoid this by using a union
that contains both void * and void *** (or intptr_t**)
and the set it to tab_ptr and read the other pointer type from it
then again iam 99% sure some people will disagree, but its the best
that can easily be done here AFAICS

also is there anything else holding this patch and dependant ones up
?
anything that needs an review ?
anything that i should apply ?

[...]

thx

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

It is dangerous to be right in matters on which the established authorities
are wrong. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140320/4e3b2720/attachment.asc>


More information about the ffmpeg-devel mailing list