From ecf955812d6b077e7d9fcd6e4f72d48688ae6e60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= Date: Mon, 3 Sep 2018 21:15:32 +0200 Subject: [PATCH] Replace reachable assertions with enforce in BigTiffImage::readData --- src/bigtiffimage.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/bigtiffimage.cpp b/src/bigtiffimage.cpp index 26165231..2672ba07 100644 --- a/src/bigtiffimage.cpp +++ b/src/bigtiffimage.cpp @@ -7,6 +7,7 @@ #include "exif.hpp" #include "error.hpp" #include "image_int.hpp" +#include "enforce.hpp" namespace Exiv2 @@ -411,7 +412,7 @@ namespace Exiv2 uint64_t readData(int size) const { const DataBuf data = Image::io().read(size); - assert(data.size_ != 0); + enforce(data.size_ != 0, kerCorruptedMetadata); uint64_t result = 0; @@ -424,7 +425,7 @@ namespace Exiv2 else if (size == 8) result = byteSwap8(data, 0, doSwap_); else - assert(!"unexpected size"); + throw Exiv2::Error(kerCorruptedMetadata); return result; }