truncate chunks first and then check for zero size
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21435 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
f4eb963104
commit
6c1def1920
@ -296,16 +296,16 @@ OpenDMLParser::Parse()
|
||||
|
||||
TRACE("OpenDMLParser::Parse: chunk '"FOURCC_FORMAT"', size = %lu, maxsize %Ld\n", FOURCC_PARAM(fourcc), size, maxsize);
|
||||
|
||||
if (size == 0) {
|
||||
ERROR("OpenDMLParser::Parse: Error: chunk of size 0 found\n");
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
if (size > maxsize) {
|
||||
ERROR("OpenDMLParser::Parse: Warning chunk '"FOURCC_FORMAT"', size = %lu extends beyond end of file\n", FOURCC_PARAM(fourcc), size);
|
||||
ERROR("OpenDMLParser::Parse: Chunk at filepos %Ld truncated to %Ld, filesize %Ld\n", pos - 8, maxsize, fSize);
|
||||
size = maxsize;
|
||||
}
|
||||
|
||||
if (size == 0) {
|
||||
ERROR("OpenDMLParser::Parse: Error: chunk of size 0 found\n");
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
if (fourcc == FOURCC('J','U','N','K')) {
|
||||
ERROR("OpenDMLParser::Parse: JUNK chunk ignored, size: %lu bytes\n", size);
|
||||
@ -392,16 +392,16 @@ OpenDMLParser::ParseChunk_AVI(int number, uint64 start, uint32 size)
|
||||
|
||||
TRACE("OpenDMLParser::ParseChunk_AVI: chunk '"FOURCC_FORMAT"', size = %lu, maxsize %lu\n", FOURCC_PARAM(Chunkfcc), Chunksize, maxsize);
|
||||
|
||||
if (Chunksize == 0) {
|
||||
ERROR("OpenDMLParser::ParseChunk_AVI: chunk '"FOURCC_FORMAT"' has size 0\n", FOURCC_PARAM(Chunkfcc));
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
if (Chunksize > maxsize) {
|
||||
TRACE("OpenDMLParser::ParseChunk_AVI: chunk '"FOURCC_FORMAT"', size = %lu too big, truncated to %lu\n", FOURCC_PARAM(Chunkfcc), Chunksize, maxsize);
|
||||
Chunksize = maxsize;
|
||||
}
|
||||
|
||||
if (Chunksize == 0) {
|
||||
ERROR("OpenDMLParser::ParseChunk_AVI: chunk '"FOURCC_FORMAT"' has size 0\n", FOURCC_PARAM(Chunkfcc));
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
if (Chunkfcc == FOURCC('L','I','S','T')) {
|
||||
if (ParseChunk_LIST(pos, Chunksize) < B_OK)
|
||||
return B_ERROR;
|
||||
|
Loading…
x
Reference in New Issue
Block a user