shithub: libopusenc

Download patch

ref: 013d0012d3c0e4b52e5d44ca642869d70c8c5008
parent: 4e8a9ae7beaf0c3117b1b0e6f0f493e5344a0b15
author: Jean-Marc Valin <[email protected]>
date: Tue Feb 6 16:49:15 EST 2018

handle NULL description

--- a/src/picture.c
+++ b/src/picture.c
@@ -234,7 +234,6 @@
   size_t         nbuf;
   size_t         data_offset;
   unsigned char *buf;
-  if (description == NULL) description = "";
   picture_file=_ope_fopen(filename,"rb");
   /*Buffer size: 8 static 4-byte fields plus 2 dynamic fields, plus the
      file/URL data.
@@ -402,6 +401,7 @@
     *error = OPE_INVALID_PICTURE;
     return NULL;
   }
+  if (description == NULL) description = "";
   buf = _ope_read_picture_file(filename, description, error, &nbuf, &data_offset);
   if (buf == NULL) return NULL;
   ret = _ope_parse_picture_specification_impl(buf, nbuf, data_offset, picture_type, description, error, seen_file_icons);
@@ -420,6 +420,7 @@
     *error = OPE_INVALID_PICTURE;
     return NULL;
   }
+  if (description == NULL) description = "";
   data_offset=32+strlen(description)+10;
   nbuf = data_offset + size;
   buf = (unsigned char *)malloc(nbuf);