aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/_ogg_common.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-09-04 11:28:13 +0200
committerMax Kellermann <max@duempel.org>2012-09-04 11:28:13 +0200
commit2a4c7994715f2b995b3ec7587f24eb0855209983 (patch)
tree4b29f97155b6ac6c35453e0937204cd9ca123007 /src/decoder/_ogg_common.c
parent333d226ed0044cf6a6387e03805be2d7f6dac6f2 (diff)
parent41487426f5fb19c963e5f94e8c4f791637e2da03 (diff)
downloadmpd-2a4c7994715f2b995b3ec7587f24eb0855209983.tar.gz
mpd-2a4c7994715f2b995b3ec7587f24eb0855209983.tar.xz
mpd-2a4c7994715f2b995b3ec7587f24eb0855209983.zip
Merge branch 'v0.17.x'
Diffstat (limited to 'src/decoder/_ogg_common.c')
-rw-r--r--src/decoder/_ogg_common.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/decoder/_ogg_common.c b/src/decoder/_ogg_common.c
index bedd3de61..09d2712da 100644
--- a/src/decoder/_ogg_common.c
+++ b/src/decoder/_ogg_common.c
@@ -33,12 +33,14 @@ ogg_stream_type ogg_stream_type_detect(struct input_stream *inStream)
size_t r;
r = decoder_read(NULL, inStream, buf, sizeof(buf));
- if (r >= 32 && memcmp(buf, "OggS", 4) == 0 && (
- (memcmp(buf+29, "FLAC", 4) == 0
- && memcmp(buf+37, "fLaC", 4) == 0)
- || (memcmp(buf+28, "FLAC", 4) == 0)
- || (memcmp(buf+28, "fLaC", 4) == 0))) {
+ if (r < sizeof(buf) || memcmp(buf, "OggS", 4) != 0)
+ return VORBIS;
+
+ if ((memcmp(buf + 29, "FLAC", 4) == 0 &&
+ memcmp(buf + 37, "fLaC", 4) == 0) ||
+ memcmp(buf + 28, "FLAC", 4) == 0 ||
+ memcmp(buf + 28, "fLaC", 4) == 0)
return FLAC;
- }
+
return VORBIS;
}