summaryrefslogtreecommitdiff
path: root/libavformat/au.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2023-08-11 23:48:39 +0200
committerPaul B Mahol <onemda@gmail.com>2023-08-11 23:55:05 +0200
commit97741adf6f2f97651698a8c8f3d5fc3587a2d984 (patch)
tree604d2ffeb59f592e23f1ca3ce50d08f27d9cb092 /libavformat/au.c
parentd53acf452f609b1235839ddb3d39ea377a965814 (diff)
avformat/au: improve au_probe()
Diffstat (limited to 'libavformat/au.c')
-rw-r--r--libavformat/au.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/libavformat/au.c b/libavformat/au.c
index 3bf2150258..63dfd71d0f 100644
--- a/libavformat/au.c
+++ b/libavformat/au.c
@@ -30,6 +30,7 @@
#include "config_components.h"
#include "libavutil/bprint.h"
+#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "internal.h"
#include "avio_internal.h"
@@ -63,11 +64,15 @@ static const AVCodecTag *const au_codec_tags[] = { codec_au_tags, NULL };
static int au_probe(const AVProbeData *p)
{
- if (p->buf[0] == '.' && p->buf[1] == 's' &&
- p->buf[2] == 'n' && p->buf[3] == 'd')
- return AVPROBE_SCORE_MAX;
- else
+ if (p->buf_size < 24 ||
+ AV_RL32(p->buf) != MKTAG('.', 's', 'n', 'd') ||
+ AV_RN32(p->buf+4) == 0 ||
+ AV_RN32(p->buf+8) == 0 ||
+ AV_RN32(p->buf+12) == 0 ||
+ AV_RN32(p->buf+16) == 0 ||
+ AV_RN32(p->buf+20) == 0)
return 0;
+ return AVPROBE_SCORE_MAX;
}
static int au_read_annotation(AVFormatContext *s, int size)