From df49a6fc65a670206ebd32f55f4660da0344dc77 Mon Sep 17 00:00:00 2001 From: ATrivialAtomic <44280901+ATrivialAtomic@users.noreply.github.com> Date: Fri, 14 Nov 2025 11:00:47 -0500 Subject: [PATCH] vcomp/cmpto_j2k.cpp - Update val comparison to DBL_MAX `unit_evaluate_dbl()` returns a double and in certain cases, the returned val may exceed UINT_MAX, causing an unexpected error. --- src/video_compress/cmpto_j2k.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/video_compress/cmpto_j2k.cpp b/src/video_compress/cmpto_j2k.cpp index 2941a7c2f..ce09ffe53 100644 --- a/src/video_compress/cmpto_j2k.cpp +++ b/src/video_compress/cmpto_j2k.cpp @@ -52,6 +52,7 @@ #endif // HAVE_CONFIG_H #include +#include #include #include #include @@ -733,7 +734,7 @@ static void usage(bool full) { #define ASSIGN_CHECK_VAL(var, str, minval) \ do { \ const double val = unit_evaluate_dbl(str, false, nullptr); \ - if (std::isnan(val) || val < (minval) || val > UINT_MAX) { \ + if (std::isnan(val) || val < (minval) || val > DBL_MAX) { \ LOG(LOG_LEVEL_ERROR) \ << "[J2K] Wrong value " << (str) \ << " for " #var "! Value must be >= " << (minval) \