From d2428b6bc7a6ad4a8ae1f7584cec7acf15c53316 Mon Sep 17 00:00:00 2001 From: David McPaul Date: Mon, 13 Mar 2006 08:11:10 +0000 Subject: [PATCH] Corrected possible infinite loop git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16755 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../plugins/mov_reader/libMOV/MOVParser.cpp | 23 ++++++++++++++++++- .../plugins/mov_reader/libMOV/MOVParser.h | 9 ++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/add-ons/media/plugins/mov_reader/libMOV/MOVParser.cpp b/src/add-ons/media/plugins/mov_reader/libMOV/MOVParser.cpp index e8ad3b50f8..7fc5d92d1b 100644 --- a/src/add-ons/media/plugins/mov_reader/libMOV/MOVParser.cpp +++ b/src/add-ons/media/plugins/mov_reader/libMOV/MOVParser.cpp @@ -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(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"; +} diff --git a/src/add-ons/media/plugins/mov_reader/libMOV/MOVParser.h b/src/add-ons/media/plugins/mov_reader/libMOV/MOVParser.h index de14d7fb48..e4e3792af9 100644 --- a/src/add-ons/media/plugins/mov_reader/libMOV/MOVParser.h +++ b/src/add-ons/media/plugins/mov_reader/libMOV/MOVParser.h @@ -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