From 0f47203a9a2eac1698a0bf1d1e54ed64fc603dc5 Mon Sep 17 00:00:00 2001 From: myang6 Date: Thu, 7 May 2026 13:59:26 -0400 Subject: [PATCH 1/3] HYRAX-2149, add the error message when a DAP4 dimension cannot be found in a DAP4 expression constraint. Previously a segmentation fault occurs. Verify with an example and it returns the expected output. --- d4_ce/D4ConstraintEvaluator.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/d4_ce/D4ConstraintEvaluator.cc b/d4_ce/D4ConstraintEvaluator.cc index ba3f517da..1fa35be8e 100644 --- a/d4_ce/D4ConstraintEvaluator.cc +++ b/d4_ce/D4ConstraintEvaluator.cc @@ -311,6 +311,10 @@ void D4ConstraintEvaluator::use_explicit_projection(Array *a, const Array::Dim_i D4Dimension *D4ConstraintEvaluator::slice_dimension(const std::string &id, const index &i) { D4Dimension *dim = dmr()->root()->find_dim(id); + if(!dim) { + throw Error(malformed_expr, + "The dimension name '" + id + "' cannot be found"); + } if ((uint64_t)i.stride > dim->size()) throw Error(malformed_expr, "For '" + id + "', the index stride value is greater than the size of the dimension"); From 91b3377026229295c13a0ad8dc1a48370bc2ae2c Mon Sep 17 00:00:00 2001 From: myang6 Date: Fri, 8 May 2026 06:25:17 -0400 Subject: [PATCH 2/3] clang-format --- d4_ce/D4ConstraintEvaluator.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/d4_ce/D4ConstraintEvaluator.cc b/d4_ce/D4ConstraintEvaluator.cc index 1fa35be8e..c67afbe41 100644 --- a/d4_ce/D4ConstraintEvaluator.cc +++ b/d4_ce/D4ConstraintEvaluator.cc @@ -312,8 +312,7 @@ D4Dimension *D4ConstraintEvaluator::slice_dimension(const std::string &id, const D4Dimension *dim = dmr()->root()->find_dim(id); if(!dim) { - throw Error(malformed_expr, - "The dimension name '" + id + "' cannot be found"); + throw Error(malformed_expr, "The dimension name '" + id + "' cannot be found"); } if ((uint64_t)i.stride > dim->size()) throw Error(malformed_expr, From 331e85d0fee9de4b20f4e2eeec0803d03b0b12fd Mon Sep 17 00:00:00 2001 From: myang6 Date: Fri, 8 May 2026 07:11:53 -0400 Subject: [PATCH 3/3] more clang-format --- d4_ce/D4ConstraintEvaluator.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/d4_ce/D4ConstraintEvaluator.cc b/d4_ce/D4ConstraintEvaluator.cc index c67afbe41..fe39ac962 100644 --- a/d4_ce/D4ConstraintEvaluator.cc +++ b/d4_ce/D4ConstraintEvaluator.cc @@ -311,7 +311,7 @@ void D4ConstraintEvaluator::use_explicit_projection(Array *a, const Array::Dim_i D4Dimension *D4ConstraintEvaluator::slice_dimension(const std::string &id, const index &i) { D4Dimension *dim = dmr()->root()->find_dim(id); - if(!dim) { + if (!dim) { throw Error(malformed_expr, "The dimension name '" + id + "' cannot be found"); } if ((uint64_t)i.stride > dim->size())