Improve sniffer behavior for fragmented MP4.
- Allow a moof box to exceed the search size. - Return immediately after reading an ftyp box with no compatible types. Issue: #784
This commit is contained in:
parent
6f9019a4e3
commit
eeb73a86ea
@ -102,13 +102,9 @@ import java.io.IOException;
|
||||
atomSize = buffer.readLong();
|
||||
}
|
||||
// Check the atom size is large enough to include its header.
|
||||
if (atomSize < headerSize || atomSize > Integer.MAX_VALUE) {
|
||||
if (atomSize < headerSize) {
|
||||
return false;
|
||||
}
|
||||
// Stop searching if reading this atom would exceed the search limit.
|
||||
if (bytesSearched + atomSize > bytesToSearch) {
|
||||
break;
|
||||
}
|
||||
int atomDataSize = (int) atomSize - headerSize;
|
||||
if (atomType == Atom.TYPE_ftyp) {
|
||||
if (atomDataSize < 8) {
|
||||
@ -126,10 +122,18 @@ import java.io.IOException;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// There is only one ftyp box, so reject the file if the file type in this box was invalid.
|
||||
if (!foundGoodFileType) {
|
||||
return false;
|
||||
}
|
||||
} else if (atomType == Atom.TYPE_moof) {
|
||||
foundFragment = true;
|
||||
break;
|
||||
} else if (atomDataSize != 0) {
|
||||
// Stop searching if reading this atom would exceed the search limit.
|
||||
if (bytesSearched + atomSize >= bytesToSearch) {
|
||||
break;
|
||||
}
|
||||
input.advancePeekPosition(atomDataSize);
|
||||
}
|
||||
bytesSearched += atomSize;
|
||||
|
Loading…
x
Reference in New Issue
Block a user