From 9d31d6d47f4acce319b94970f548b6f42f17a353 Mon Sep 17 00:00:00 2001 From: netliomax25-code Date: Fri, 29 May 2026 18:14:14 +0530 Subject: [PATCH] enforce minimum FileTypeBox length in Jp2Image::printStructure --- src/jp2image.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/jp2image.cpp b/src/jp2image.cpp index 9398035e9f..6548de8b8c 100644 --- a/src/jp2image.cpp +++ b/src/jp2image.cpp @@ -444,6 +444,7 @@ void Jp2Image::printStructure(std::ostream& out, PrintStructureOption option, si case kJp2BoxType::FileTypeBox: { // This box shall immediately follow the JPEG 2000 Signature box /// \todo All files shall contain one and only one File Type box. + Internal::enforce(box.length >= boxHSize, ErrorCode::kerCorruptedMetadata); Blob boxData(box.length - boxHSize); io_->readOrThrow(boxData.data(), boxData.size(), ErrorCode::kerCorruptedMetadata); if (!Internal::isValidBoxFileType(boxData))