From 1d8e2040804d5129b1e09265820ea3e9df7925bb Mon Sep 17 00:00:00 2001 From: Mohamed Ali Chebbi Date: Tue, 13 Dec 2022 12:52:00 +0100 Subject: [PATCH] limit the buffer_size --- src/riffvideo.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/riffvideo.cpp b/src/riffvideo.cpp index 5ec9ef3241..287df96f41 100644 --- a/src/riffvideo.cpp +++ b/src/riffvideo.cpp @@ -506,6 +506,7 @@ void RiffVideo::printStructure(std::ostream& out, PrintStructureOption option, s << std::endl; } + const uint64_t bufMaxSize = 200; io_->seek(0, BasicIo::beg); // rewind while (!io_->eof() && (uint64_t)io_->tell() < filesize) { uint64_t offset = (uint64_t)io_->tell(); @@ -513,6 +514,10 @@ void RiffVideo::printStructure(std::ostream& out, PrintStructureOption option, s io_->read(chunkId.data(), RIFF_TAG_SIZE); io_->read(size_buff, RIFF_TAG_SIZE); uint32_t size = Exiv2::getULong(size_buff, littleEndian); + if (size > bufMaxSize) { + io_->seek(size, BasicIo::cur); + continue; + } DataBuf payload(offset ? size : RIFF_TAG_SIZE); // header is different from chunks io_->read(payload.data(), payload.size());