From f796e4d632c9c64b115d44838cf475bc4e4d101b Mon Sep 17 00:00:00 2001 From: Nicholas Devenish Date: Tue, 15 Aug 2023 11:14:53 +0100 Subject: [PATCH 1/2] Fix undefined behaviour from unthrown error --- newsfragments/XXX.bugfix | 1 + src/dxtbx/model/beam.h | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 newsfragments/XXX.bugfix diff --git a/newsfragments/XXX.bugfix b/newsfragments/XXX.bugfix new file mode 100644 index 000000000..6696aae3a --- /dev/null +++ b/newsfragments/XXX.bugfix @@ -0,0 +1 @@ +Fix situation where a bad ``Beam.probe`` could cause undefined behaviour. diff --git a/src/dxtbx/model/beam.h b/src/dxtbx/model/beam.h index 6df5325d1..7f9cefb37 100644 --- a/src/dxtbx/model/beam.h +++ b/src/dxtbx/model/beam.h @@ -319,7 +319,7 @@ namespace dxtbx { namespace model { case neutron: return std::string("neutron"); default: - DXTBX_ERROR("Unknown probe type"); + throw DXTBX_ERROR("Unknown probe type"); } } @@ -335,7 +335,7 @@ namespace dxtbx { namespace model { return Probe::neutron; } - DXTBX_ERROR("Unknown probe " + probe); + throw DXTBX_ERROR("Unknown probe " + probe); } void set_probe(Probe probe) { From feed6bf8384568913322a125ab26d3664764f60c Mon Sep 17 00:00:00 2001 From: DiamondLightSource-build-server Date: Tue, 15 Aug 2023 10:16:30 +0000 Subject: [PATCH 2/2] Rename newsfragments/XXX.bugfix to newsfragments/656.bugfix --- newsfragments/{XXX.bugfix => 656.bugfix} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename newsfragments/{XXX.bugfix => 656.bugfix} (100%) diff --git a/newsfragments/XXX.bugfix b/newsfragments/656.bugfix similarity index 100% rename from newsfragments/XXX.bugfix rename to newsfragments/656.bugfix