]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/tiff.c
mp3dec: ask for 8khz switch point mp3s
[ffmpeg] / libavcodec / tiff.c
index 65081b32ff4c27678e7b3ec463b7e1e42203cddc..579bd0d5f70320e6b82620860887ddabe3245e50 100644 (file)
@@ -26,6 +26,7 @@
 
 #include "avcodec.h"
 #include "bytestream.h"
+#include "config.h"
 #if CONFIG_ZLIB
 #include <zlib.h>
 #endif
@@ -206,14 +207,17 @@ static char *doubles2str(double *dp, int count, const char *sep)
 {
     int i;
     char *ap, *ap0;
+    int component_len = 15 + strlen(sep);
     if (!sep) sep = ", ";
-    ap = av_malloc((15 + strlen(sep)) * count);
+    ap = av_malloc(component_len * count);
     if (!ap)
         return NULL;
     ap0   = ap;
     ap[0] = '\0';
     for (i = 0; i < count; i++) {
-        int l = snprintf(ap, 15 + strlen(sep), "%f%s", dp[i], sep);
+        unsigned l = snprintf(ap, component_len, "%f%s", dp[i], sep);
+        if(l >= component_len)
+            return NULL;
         ap += l;
     }
     ap0[strlen(ap0) - strlen(sep)] = '\0';
@@ -1004,6 +1008,8 @@ static int decode_frame(AVCodecContext *avctx,
         return -1;
     }
     s->le = le;
+    // TIFF_BPP is not a required tag and defaults to 1
+    s->bppcount = s->bpp = 1;
     s->invert = 0;
     s->compr = TIFF_RAW;
     s->fill_order = 0;