From a7833205206c96de517f59bf9c2ce91e3a0dfbe1 Mon Sep 17 00:00:00 2001 From: Kevin Backhouse Date: Sat, 11 Mar 2023 23:34:37 +0000 Subject: [PATCH] Use enforce, not assert, to avoid crash. --- src/matroskavideo.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/matroskavideo.cpp b/src/matroskavideo.cpp index b9b01f69..62f0dabd 100644 --- a/src/matroskavideo.cpp +++ b/src/matroskavideo.cpp @@ -22,6 +22,7 @@ #include "config.h" #include "basicio.hpp" +#include "enforce.hpp" #include "error.hpp" #include "futils.hpp" #include "helper_functions.hpp" @@ -31,7 +32,6 @@ // + standard includes #include -#include #include #include #include @@ -585,7 +585,7 @@ const MatroskaTag streamRate[] = { Returns Tag Value. */ [[nodiscard]] size_t returnTagValue(const byte* buf, size_t size) { - assert(size > 0 && size <= 8); + enforce(size > 0 && size <= 8, Exiv2::ErrorCode::kerCorruptedMetadata); size_t b0 = buf[0] & (0xff >> size); size_t tag = b0 << ((size - 1) * 8);