On Sat, Oct 15, 2016 at 03:05:11AM -0700, Thomas Turner wrote: > Added test for libavcodec/avpacket.c > Function(s) tested: av_packet_clone() > > Signed-off-by: Thomas Turner <thomas...@gmail.com> > --- > libavcodec/Makefile | 3 +- > libavcodec/tests/avpacket.c | 115 > ++++++++++++++++++++++++++++++++++++++++++++ > tests/fate/libavcodec.mak | 5 ++ > 3 files changed, 122 insertions(+), 1 deletion(-) > create mode 100644 libavcodec/tests/avpacket.c > > diff --git a/libavcodec/Makefile b/libavcodec/Makefile > index a1560ba..d64b8df 100644 > --- a/libavcodec/Makefile > +++ b/libavcodec/Makefile > @@ -1016,7 +1016,8 @@ SKIPHEADERS-$(CONFIG_VDA) += vda.h > vda_vt_internal.h > SKIPHEADERS-$(CONFIG_VDPAU) += vdpau.h vdpau_internal.h > SKIPHEADERS-$(CONFIG_VIDEOTOOLBOX) += videotoolbox.h vda_vt_internal.h > > -TESTPROGS = imgconvert \ > +TESTPROGS = avpacket \ > + imgconvert \ > jpeg2000dwt \ > mathops \ > options \ > diff --git a/libavcodec/tests/avpacket.c b/libavcodec/tests/avpacket.c > new file mode 100644 > index 0000000..d02f2e2 > --- /dev/null > +++ b/libavcodec/tests/avpacket.c > @@ -0,0 +1,115 @@ > +/* > + * This file is part of FFmpeg. > + * > + * FFmpeg is free software; you can redistribute it and/or > + * modify it under the terms of the GNU Lesser General Public > + * License as published by the Free Software Foundation; either > + * version 2.1 of the License, or (at your option) any later version. > + * > + * FFmpeg is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + * Lesser General Public License for more details. > + * > + * You should have received a copy of the GNU Lesser General Public > + * License along with FFmpeg; if not, write to the Free Software > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 > USA > + */ > + > +#include <stdio.h> > +#include <stdlib.h> > +#include <inttypes.h> > +#include "libavcodec/avcodec.h" > + > + > + > +static void LOG_AVPACKET(AVPacket* avpkt, const char* message) > +{ > + char buf_info[256]; > + char data_info[256]; > + > + if(avpkt->buf) > + sprintf(buf_info, "{buffer: %p, data: %p, size: %d}", > + avpkt->buf->buffer, avpkt->buf->data, avpkt->buf->size); > + else > + sprintf(buf_info, "{}");
length checks (as in snprintf() are needed for saftey) also the code segfaults: #0 0x00007ffff764ca60 in ?? () from /lib/x86_64-linux-gnu/libc.so.6 #1 0x0000000000402ae3 in av_packet_ref (dst=0x60e040, src=0x7fffffffe350) at /usr/include/x86_64-linux-gnu/bits/string3.h:52 #2 0x0000000000402bd1 in av_packet_clone (src=0x7fffffffe350) at libavcodec/avpacket.c:616 #3 0x00000000004010d1 in TEST_AV_PACKET_CLONE () at libavcodec/tests/avpacket.c:87 #4 main () at libavcodec/tests/avpacket.c:11 [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Avoid a single point of failure, be that a person or equipment.
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel