From 9099919bbc97b632438acb68aaa5438aaf589e5f Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 14 Feb 2023 16:27:32 +0100 Subject: [PATCH] #9844 Summary Restart: Add more guarding on empty strings When trying to import a restart case, parsing of the restart path causes crash in some cases. Add more checking on NULL. --- ThirdParty/Ert/lib/ecl/ecl_util.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ThirdParty/Ert/lib/ecl/ecl_util.cpp b/ThirdParty/Ert/lib/ecl/ecl_util.cpp index d8efe8c7b1..7a845adb75 100644 --- a/ThirdParty/Ert/lib/ecl/ecl_util.cpp +++ b/ThirdParty/Ert/lib/ecl/ecl_util.cpp @@ -378,6 +378,10 @@ static bool valid_base(const char * input_base, bool * upper_case) { static char * ecl_util_alloc_filename_static(const char * path, const char * base , ecl_file_enum file_type , bool fmt_file, int report_nr, bool must_exist) { bool upper_case; + + if (base == NULL) + return NULL; + if (!valid_base(base, &upper_case)) return NULL; @@ -877,7 +881,7 @@ bool ecl_util_alloc_summary_files(const char * path , const char * _base , const else base = (char *) _base; - if (ext != NULL) { + if (base != NULL && ext != NULL) { ecl_file_enum input_type; {