From 5f033ce72d1bb7a3bd0f654a16b3ac0b515bedb7 Mon Sep 17 00:00:00 2001 From: jgabaut <109908086+jgabaut@users.noreply.github.com> Date: Fri, 3 Nov 2023 17:15:33 +0100 Subject: [PATCH] 0.3.5 - kls_temp_start() returns NULL instead of failing assertion (#40) * feat: handle already-started temp by returning NULL --- bin/stego.lock | 1 + bin/v0.3.5/.gitignore | 4 ++++ bin/v0.3.5/static | 1 + configure.ac | 4 ++-- docs/koliseo.doxyfile | 2 +- src/koliseo.c | 15 +++++++++++++-- src/koliseo.h | 4 ++-- 7 files changed, 24 insertions(+), 7 deletions(-) create mode 100644 bin/v0.3.5/.gitignore create mode 120000 bin/v0.3.5/static diff --git a/bin/stego.lock b/bin/stego.lock index 1256b48..ceeb8f7 100644 --- a/bin/stego.lock +++ b/bin/stego.lock @@ -36,3 +36,4 @@ tests# tests folder name 0.3.2# Add backend selection for automatic KLS_Region list. 0.3.3# Fix Koliseo_Temp reglist_kls having a static size 0.3.4# Add kls_maxRegions_KLS_BASIC, handle KLS_BASIC in kls_insord_p(), fix list macros args +0.3.5# Shush stderr message, return null on bad kls_temp_start() diff --git a/bin/v0.3.5/.gitignore b/bin/v0.3.5/.gitignore new file mode 100644 index 0000000..f915d8e --- /dev/null +++ b/bin/v0.3.5/.gitignore @@ -0,0 +1,4 @@ +#amboso compliant version folder, will ignore everything inside BUT the gitignore, to keep the clean dir +* +!.gitignore +!static diff --git a/bin/v0.3.5/static b/bin/v0.3.5/static new file mode 120000 index 0000000..382349a --- /dev/null +++ b/bin/v0.3.5/static @@ -0,0 +1 @@ +../../static/ \ No newline at end of file diff --git a/configure.ac b/configure.ac index cb6e5a0..a837d16 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ # Define the package name and version -AC_INIT([koliseo], [0.3.4], [jgabaut@github.com]) +AC_INIT([koliseo], [0.3.5], [jgabaut@github.com]) # Verify automake version and enable foreign option AM_INIT_AUTOMAKE([foreign -Wall]) @@ -48,7 +48,7 @@ fi # Set a default version number if not specified externally AC_ARG_VAR([VERSION], [Version number]) if test -z "$VERSION"; then - VERSION="0.3.4" + VERSION="0.3.5" fi # Output variables to the config.h header diff --git a/docs/koliseo.doxyfile b/docs/koliseo.doxyfile index a213e70..1bb4a92 100644 --- a/docs/koliseo.doxyfile +++ b/docs/koliseo.doxyfile @@ -48,7 +48,7 @@ PROJECT_NAME = "koliseo" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = "0.3.4" +PROJECT_NUMBER = "0.3.5" # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/src/koliseo.c b/src/koliseo.c index 44c5e2d..cb5a31d 100644 --- a/src/koliseo.c +++ b/src/koliseo.c @@ -2029,7 +2029,9 @@ void kls_free(Koliseo* kls) { fprintf(stderr,"[ERROR] %s(): Failed fclose() on log_fp. Path: {\"%s\"}.", __func__, kls->conf.kls_log_filepath); } } else if (kls->conf.kls_log_fp == stdout || kls->conf.kls_log_fp == stderr){ - fprintf(stderr,"[INFO] %s(): kls->conf.kls_log_fp is %s. Not closing it.\n", __func__, (kls->conf.kls_log_fp == stdout ? "stdout" : "stderr")); + if (kls->conf.kls_verbose_lvl > 1) { + fprintf(stderr,"[INFO] %s(): kls->conf.kls_log_fp is %s. Not closing it.\n", __func__, (kls->conf.kls_log_fp == stdout ? "stdout" : "stderr")); + } } if (kls->conf.kls_reglist_alloc_backend == KLS_REGLIST_ALLOC_KLS_BASIC) { kls_free(kls->reglist_kls); @@ -2052,7 +2054,16 @@ Koliseo_Temp* kls_temp_start(Koliseo* kls) { fprintf(stderr,"[ERROR] [%s()]: Passed Koliseo was NULL.\n",__func__); exit(EXIT_FAILURE); } - assert(kls->has_temp == 0); //TODO handle this more gracefully + if (kls->has_temp != 0) { + fprintf(stderr,"[ERROR] [%s()]: Passed Koliseo->has_temp is not 0. {%i}\n",__func__, kls->has_temp); + #ifdef KLS_DEBUG_CORE + kls_log(kls,"ERROR","[%s()]: Passed Koliseo->has_temp != 0 . {%i}",__func__,kls->has_temp); + #endif + if (kls->conf.kls_collect_stats == 1) { + kls->stats.tot_hiccups += 1; + } + return NULL; + } ptrdiff_t prev = kls->prev_offset; ptrdiff_t off = kls->offset; diff --git a/src/koliseo.h b/src/koliseo.h index 533aeef..3872bf5 100644 --- a/src/koliseo.h +++ b/src/koliseo.h @@ -24,7 +24,7 @@ #define KLS_MAJOR 0 /**< Represents current major release.*/ #define KLS_MINOR 3 /**< Represents current minor release.*/ -#define KLS_PATCH 4 /**< Represents current patch release.*/ +#define KLS_PATCH 5 /**< Represents current patch release.*/ /*! \mainpage Koliseo index page * @@ -155,7 +155,7 @@ static const int KOLISEO_API_VERSION_INT = (KLS_MAJOR*1000000+KLS_MINOR*10000+KL /** * Defines current API version string. */ -static const char KOLISEO_API_VERSION_STRING[] = "0.3.4"; /**< Represents current version with MAJOR.MINOR.PATCH format.*/ +static const char KOLISEO_API_VERSION_STRING[] = "0.3.5"; /**< Represents current version with MAJOR.MINOR.PATCH format.*/ const char* string_koliseo_version(void);