From e884b561cd20d10c67ce897816d79905523e0fc8 Mon Sep 17 00:00:00 2001 From: Packit Bot Date: May 05 2021 22:16:03 +0000 Subject: Prepare for a new update Reverting patches so we can apply the latest update and changes can be seen in the spec file and sources. --- diff --git a/cmake/compilerFlags.cmake b/cmake/compilerFlags.cmake index 257eb98..0418aa6 100644 --- a/cmake/compilerFlags.cmake +++ b/cmake/compilerFlags.cmake @@ -26,7 +26,7 @@ if ( MINGW OR UNIX OR MSYS ) # MINGW, Linux, APPLE, CYGWIN # This fails under Fedora, MinGW GCC 8.3.0 and CYGWIN/MSYS 9.3.0 if (NOT (MINGW OR CMAKE_HOST_SOLARIS OR CYGWIN OR MSYS) ) if (COMPILER_IS_GCC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) - add_compile_options(-fstack-clash-protection) + add_compile_options(-fstack-clash-protection -fcf-protection) endif() if( (COMPILER_IS_GCC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 5.0) # Not in GCC 4.8 diff --git a/src/crwimage_int.cpp b/src/crwimage_int.cpp index 2e3e507..aefaf22 100644 --- a/src/crwimage_int.cpp +++ b/src/crwimage_int.cpp @@ -559,7 +559,7 @@ namespace Exiv2 { void CiffComponent::setValue(DataBuf buf) { if (isAllocated_) { - delete[] pData_; + delete pData_; pData_ = 0; size_ = 0; } @@ -1167,11 +1167,7 @@ namespace Exiv2 { pCrwMapping->crwDir_); if (edX != edEnd || edY != edEnd || edO != edEnd) { uint32_t size = 28; - if (cc) { - if (cc->size() < size) - throw Error(kerCorruptedMetadata); - size = cc->size(); - } + if (cc && cc->size() > size) size = cc->size(); DataBuf buf(size); std::memset(buf.pData_, 0x0, buf.size_); if (cc) std::memcpy(buf.pData_ + 8, cc->pData() + 8, cc->size() - 8); diff --git a/src/jp2image.cpp b/src/jp2image.cpp index 0961203..0de088d 100644 --- a/src/jp2image.cpp +++ b/src/jp2image.cpp @@ -28,7 +28,6 @@ #include "image.hpp" #include "image_int.hpp" #include "basicio.hpp" -#include "enforce.hpp" #include "error.hpp" #include "futils.hpp" #include "types.hpp" @@ -354,7 +353,7 @@ static void boxes_check(size_t b,size_t m) if (io_->error()) throw Error(kerFailedToReadImageData); if (bufRead != rawData.size_) throw Error(kerInputDataReadFailed); - if (rawData.size_ > 8) // "II*\0long" + if (rawData.size_ > 0) { // Find the position of Exif header in bytes array. long pos = ( (rawData.pData_[0] == rawData.pData_[1]) @@ -498,7 +497,6 @@ static void boxes_check(size_t b,size_t m) position = io_->tell(); box.length = getLong((byte*)&box.length, bigEndian); box.type = getLong((byte*)&box.type, bigEndian); - enforce(box.length <= io_->size()-io_->tell() , Exiv2::kerCorruptedMetadata); if (bPrint) { out << Internal::stringFormat("%8ld | %8ld | ", (size_t)(position - sizeof(box)), @@ -583,13 +581,12 @@ static void boxes_check(size_t b,size_t m) throw Error(kerInputDataReadFailed); if (bPrint) { - out << Internal::binaryToString( - makeSlice(rawData, 0, rawData.size_>40?40:rawData.size_)); + out << Internal::binaryToString(makeSlice(rawData, 0, 40)); out.flush(); } lf(out, bLF); - if (bIsExif && bRecursive && rawData.size_ > 8) { // "II*\0long" + if (bIsExif && bRecursive && rawData.size_ > 0) { if ((rawData.pData_[0] == rawData.pData_[1]) && (rawData.pData_[0] == 'I' || rawData.pData_[0] == 'M')) { BasicIo::AutoPtr p = BasicIo::AutoPtr(new MemIo(rawData.pData_, rawData.size_)); @@ -776,10 +773,9 @@ static void boxes_check(size_t b,size_t m) #endif box.length = (uint32_t) (io_->size() - io_->tell() + 8); } - if (box.length < 8) + if (box.length == 1) { - // box is broken, so there is nothing we can do here - throw Error(kerCorruptedMetadata); + // FIXME. Special case. the real box size is given in another place. } // Read whole box : Box header + Box data (not fixed size - can be null).