Skip to content

Commit be6fa19

Browse files
committed
check quicktime for 'ftype qt ' magic numbers
1 parent 3305bbb commit be6fa19

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

matchers/video.go

+7-8
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,14 @@ func Webm(buf []byte) bool {
4949
buf[2] == 0xDF && buf[3] == 0xA3 &&
5050
containsMatroskaSignature(buf, []byte{'w', 'e', 'b', 'm'})
5151
}
52-
5352
func Mov(buf []byte) bool {
54-
return len(buf) > 15 && ((buf[0] == 0x0 && buf[1] == 0x0 &&
55-
buf[2] == 0x0 && buf[3] == 0x14 &&
56-
buf[4] == 0x66 && buf[5] == 0x74 &&
57-
buf[6] == 0x79 && buf[7] == 0x70) ||
58-
(buf[4] == 0x6d && buf[5] == 0x6f && buf[6] == 0x6f && buf[7] == 0x76) ||
59-
(buf[4] == 0x6d && buf[5] == 0x64 && buf[6] == 0x61 && buf[7] == 0x74) ||
60-
(buf[12] == 0x6d && buf[13] == 0x64 && buf[14] == 0x61 && buf[15] == 0x74))
53+
return len(buf) > 15 && (
54+
(buf[4] == 0x66 && buf[5] == 0x74 && buf[6] == 0x79 && buf[7] == 0x70) &&
55+
((buf[8] == 0x71 && buf[9] == 0x74 && buf[10] == 0x20 && buf[11] == 0x20) ||
56+
(buf[0] == 0x0 && buf[1] == 0x0 && buf[2] == 0x0 && buf[3] == 0x14)) ||
57+
(buf[4] == 0x6d && buf[5] == 0x6f && buf[6] == 0x6f && buf[7] == 0x76) ||
58+
(buf[4] == 0x6d && buf[5] == 0x64 && buf[6] == 0x61 && buf[7] == 0x74) ||
59+
(buf[12] == 0x6d && buf[13] == 0x64 && buf[14] == 0x61 && buf[15] == 0x74))
6160
}
6261

6362
func Avi(buf []byte) bool {

0 commit comments

Comments
 (0)