Skip to content

Commit

Permalink
0.3.5 - kls_temp_start() returns NULL instead of failing assertion (#40)
Browse files Browse the repository at this point in the history
* feat: handle already-started temp by returning NULL
  • Loading branch information
jgabaut committed Nov 3, 2023
1 parent 91d097d commit 5f033ce
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 7 deletions.
1 change: 1 addition & 0 deletions bin/stego.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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()
4 changes: 4 additions & 0 deletions bin/v0.3.5/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#amboso compliant version folder, will ignore everything inside BUT the gitignore, to keep the clean dir
*
!.gitignore
!static
1 change: 1 addition & 0 deletions bin/v0.3.5/static
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Define the package name and version
AC_INIT([koliseo], [0.3.4], [[email protected]])
AC_INIT([koliseo], [0.3.5], [[email protected]])

# Verify automake version and enable foreign option
AM_INIT_AUTOMAKE([foreign -Wall])
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/koliseo.doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 13 additions & 2 deletions src/koliseo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions src/koliseo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 5f033ce

Please sign in to comment.