Compare commits

..

2 Commits

2 changed files with 7 additions and 2 deletions

View File

@@ -185,7 +185,8 @@ void akerr_init_errno(void);
#define VALID(__err_context, __stmt) \ #define VALID(__err_context, __stmt) \
__stmt; \ __stmt; \
if ( akerr_valid_error_address(__err_context) == 1 ) { \ if ( akerr_valid_error_address(__err_context) == 0 ) { \
__err_context = NULL; \
FAIL(__err_context, AKERR_BEHAVIOR, "Received (akerr_Error *) from an invalid memory region. (Did the method finish without calling SUCCEED_RETURN?)"); \ FAIL(__err_context, AKERR_BEHAVIOR, "Received (akerr_Error *) from an invalid memory region. (Did the method finish without calling SUCCEED_RETURN?)"); \
} }

View File

@@ -17,7 +17,11 @@ akerr_ErrorContext AKERR_ARRAY_ERROR[AKERR_MAX_ARRAY_ERROR];
int akerr_valid_error_address(akerr_ErrorContext *ptr) int akerr_valid_error_address(akerr_ErrorContext *ptr)
{ {
// Is this within the memory region occupied by AKERR_ARRAY_ERROR? // Is this within the memory region occupied by AKERR_ARRAY_ERROR?
return ((ptr >= &AKERR_ARRAY_ERROR[0]) && (ptr <= &AKERR_ARRAY_ERROR[AKERR_MAX_ARRAY_ERROR-1])); if ( ptr == NULL ) {
return 1;
}
return ((ptr >= &AKERR_ARRAY_ERROR[0]) &&
(ptr <= &AKERR_ARRAY_ERROR[AKERR_MAX_ARRAY_ERROR-1]));
} }
void akerr_default_logger(const char *fmt, ...) void akerr_default_logger(const char *fmt, ...)