avformat/flac_picture: try to guess PNG by actual picture data
authorPaul B Mahol <onemda@gmail.com>
Thu, 13 Dec 2018 19:12:52 +0000 (20:12 +0100)
committerPaul B Mahol <onemda@gmail.com>
Fri, 14 Dec 2018 10:32:27 +0000 (11:32 +0100)
Fixes #5028.

libavformat/flac_picture.c

index 38982b9..8317ab2 100644 (file)
@@ -20,6 +20,8 @@
  */
 
 #include "libavutil/avassert.h"
+#include "libavutil/intreadwrite.h"
+#include "libavcodec/png.h"
 #include "avformat.h"
 #include "flac_picture.h"
 #include "id3v2.h"
@@ -119,6 +121,9 @@ int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size)
         goto fail;
     }
 
+    if (AV_RB64(data->data) == PNGSIG)
+        id = AV_CODEC_ID_PNG;
+
     st = avformat_new_stream(s, NULL);
     if (!st) {
         RETURN_ERROR(AVERROR(ENOMEM));