Corrected possible infinite loop

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16755 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
David McPaul 2006-03-13 08:11:10 +00:00
parent 8607ac2ce7
commit d2428b6bc7
2 changed files with 31 additions and 1 deletions

View File

@ -177,6 +177,10 @@ AtomBase *getAtom(BPositionIO *pStream)
return new ESDSAtom(pStream, aStreamOffset, aAtomType, aRealAtomSize);
}
if (aAtomType == uint32('ftyp')) {
return new FTYPAtom(pStream, aStreamOffset, aAtomType, aRealAtomSize);
}
return new AtomBase(pStream, aStreamOffset, aAtomType, aRealAtomSize);
}
@ -855,7 +859,7 @@ void STSDAtom::ReadSoundDescription()
memcpy(aSoundDescriptionV1->theVOL,dynamic_cast<ESDSAtom *>(aAtomBase)->getVOL(),aSoundDescriptionV1->VOLSize);
}
if (aAtomBase->getAtomSize() > 0) {
if ((aAtomBase->getAtomSize() > 0) && (descBytesLeft >= aAtomBase->getAtomSize())) {
descBytesLeft = descBytesLeft - aAtomBase->getAtomSize();
} else {
DEBUGGER("Invalid Atom found when reading Sound Description\n");
@ -1423,3 +1427,20 @@ char *SMHDAtom::OnGetAtomName()
{
return "Quicktime Sound Media Header";
}
FTYPAtom::FTYPAtom(BPositionIO *pStream, off_t pstreamOffset, uint32 patomType, uint64 patomSize) : AtomBase(pStream, pstreamOffset, patomType, patomSize)
{
}
FTYPAtom::~FTYPAtom()
{
}
void FTYPAtom::OnProcessMetaData()
{
}
char *FTYPAtom::OnGetAtomName()
{
return "Quicktime File Type";
}

View File

@ -472,4 +472,13 @@ private:
hdlr theHeader;
};
class FTYPAtom : public AtomBase {
public:
FTYPAtom(BPositionIO *pStream, off_t pstreamOffset, uint32 patomType, uint64 patomSize);
virtual ~FTYPAtom();
void OnProcessMetaData();
char *OnGetAtomName();
};
#endif