[FFmpeg-devel] [PATCH]Recognize qt compatible brand in isom

Carl Eugen Hoyos cehoyos at ag.or.at
Sat Nov 17 23:25:24 CET 2012


On Saturday 17 November 2012 02:27:41 am Michael Niedermayer wrote:
> On Thu, Nov 15, 2012 at 01:42:47PM +0000, Carl Eugen Hoyos wrote:
> > Carl Eugen Hoyos <cehoyos <at> ag.or.at> writes:
> > > > > On Fri, Nov 02, 2012 at 03:37:32PM +0100, Carl Eugen Hoyos wrote:
> > > > > > Attached patch fixes ticket #1881 for me
> > > >
> > > > Less intrusive patch attached.
> > >
> > > I will apply this patch (that has less impact than
> > > the other one) if nobody objects.
> >
> > Patch applied, Carl Eugen
>
> coverity thinks this adds a potential null pointer dereference

I thought whenever isom is set the compatible_brands metadata also gets set, 
but I may be wrong.

Is attached patch ok?

Carl Eugen
-------------- next part --------------
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 9b179cb..cff9c92 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1384,6 +1384,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
         } else if (st->codec->codec_type==AVMEDIA_TYPE_AUDIO) {
             int bits_per_sample, flags;
             uint16_t version = avio_rb16(pb);
+            AVDictionaryEntry *compatible_brands = av_dict_get(c->fc->metadata, "compatible_brands", NULL, AV_DICT_MATCH_CASE);
 
             st->codec->codec_id = id;
             avio_rb16(pb); /* revision level */
@@ -1401,7 +1402,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
             //Read QT version 1 fields. In version 0 these do not exist.
             av_dlog(c->fc, "version =%d, isom =%d\n",version,c->isom);
             if (!c->isom ||
-                strstr(av_dict_get(c->fc->metadata, "compatible_brands", NULL, AV_DICT_MATCH_CASE)->value, "qt  ")) {
+                (compatible_brands && strstr(compatible_brands->value, "qt  "))) {
                 if (version==1) {
                     sc->samples_per_frame = avio_rb32(pb);
                     avio_rb32(pb); /* bytes per packet */


More information about the ffmpeg-devel mailing list