When testing for mp4 video file types, I encountered a range issue when checking byte ranges. The code was comparing an array of bytes that have mismatched lengths, therefore the check for a valid mp4 file would always fail since the range checked had a length of 12, and the expected byte values had a range of 16 (with 4 empty bytes at the end of the range).
I have fixed this by removing the check for the last 4 empty bytes, so the range count now matches and will successfully find a valid mp4 file. Attached is the mp4 file I was testing against.
Commit details:
fix mismatched range of bytes check
the signature check for mp4 bytes included 16 values, but was only comparing against 12 values, so the check would always fail.
removed the check for the empty bytes at the end of the range
When testing for mp4 video file types, I encountered a range issue when checking byte ranges. The code was comparing an array of bytes that have mismatched lengths, therefore the check for a valid mp4 file would always fail since the range checked had a length of 12, and the expected byte values had a range of 16 (with 4 empty bytes at the end of the range).
I have fixed this by removing the check for the last 4 empty bytes, so the range count now matches and will successfully find a valid mp4 file. Attached is the mp4 file I was testing against.
Commit details:
https://user-images.githubusercontent.com/110691/134053079-26397b8b-d023-45b8-965d-f1eb2207c3ed.mp4