[FFmpeg-devel] [PATCH] lavfi/avcodec: add consistency checks in avfilter_copy_buf_props()
Michael Niedermayer
michaelni at gmx.at
Wed Jun 13 11:36:05 CEST 2012
On Wed, Jun 13, 2012 at 10:59:13AM +0200, Stefano Sabatini wrote:
> On date Sunday 2012-06-10 20:28:50 +0200, Michael Niedermayer encoded:
> > On Sun, Jun 10, 2012 at 06:34:30PM +0200, Stefano Sabatini wrote:
> > > Fix possible crash.
> > > ---
> > > libavfilter/avcodec.c | 6 ++++++
> > > 1 files changed, 6 insertions(+), 0 deletions(-)
> >
> > the dst==NULL case and src==dst==NULL should be ok
> >
>
> > about dst!=NULL && src==NULL iam unsure, it would leave the destination
> > in undefined state if the user app doesnt check the return value thus
> > a immedeate crash may actually be better
>
> Added an assert in that case.
>
> I'm unsure about what to do with the type inconsistency cases (VIDEO
> && !ref->video), maybe should I add an assert as well there?
if theres no legitimate case where that can happen then it should be
better to assert()
> --
> FFmpeg = Fantastic and Fabulous Martial Portentous Ecumenical Generator
> avcodec.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
> cd20468806698786ba0ee2fa2d8d0af4e392691d 0001-lavfi-avcodec-add-consistency-checks-in-avfilter_cop.patch
> From 816bcbffaf8ee245160c0765b198dce88b4901fa Mon Sep 17 00:00:00 2001
> From: Stefano Sabatini <stefasab at gmail.com>
> Date: Sun, 10 Jun 2012 18:17:50 +0200
> Subject: [PATCH] lavfi/avcodec: add consistency checks in
> avfilter_copy_buf_props()
>
> ---
> libavfilter/avcodec.c | 9 +++++++++
> 1 files changed, 9 insertions(+), 0 deletions(-)
>
> diff --git a/libavfilter/avcodec.c b/libavfilter/avcodec.c
> index 6b23772..30e9cdf 100644
> --- a/libavfilter/avcodec.c
> +++ b/libavfilter/avcodec.c
> @@ -83,6 +83,11 @@ int avfilter_copy_buf_props(AVFrame *dst, const AVFilterBufferRef *src)
> {
> int planes, nb_channels;
>
> + if (!dst)
> + return AVERROR(EINVAL);
> + /* abort in case the src is NULL and dst is not, avoid inconsistent state in dst */
> + av_assert2(src);
id say av_assert0()
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The real ebay dictionary, page 3
"Rare item" - "Common item with rare defect or maybe just a lie"
"Professional" - "'Toy' made in china, not functional except as doorstop"
"Experts will know" - "The seller hopes you are not an expert"
-------------- 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/20120613/7a8c1dee/attachment.asc>
More information about the ffmpeg-devel
mailing list