Fix for Kazlib exception code:

Defect number: 0011
Date: Jul 26 2001
Releases of Kazlib affected: 1.10 through 1.19
Status: Fixed in 1.20
Modules affected: except.c
Description: Members of the except_t structure needed to be declared
    volatile because the structure is automatically allocated in the
    except macro, modified after a setjmp() takes place, and accessed
    after control returns via longjmp.
Solution: Upgrade to 1.20 or backpatch the fix.

svn path=/trunk/; revision=3793
This commit is contained in:
Gilbert Ramirez 2001-07-27 16:20:39 +00:00
parent 5bb08b0970
commit 52d5904afd
2 changed files with 8 additions and 8 deletions

View File

@ -13,7 +13,7 @@
* This source code may be translated into executable form and incorporated
* into proprietary software; there is no requirement for such software to
* contain a copyright notice related to this source.
* $Id: except.c,v 1.1 2000/09/27 04:54:49 gram Exp $
* $Id: except.c,v 1.2 2001/07/27 16:20:39 gram Exp $
* $Name: $
*/
@ -27,7 +27,7 @@
#define XCEPT_BUFFER_SIZE 1024
#ifdef KAZLIB_RCSID
static const char rcsid[] = "$Id: except.c,v 1.1 2000/09/27 04:54:49 gram Exp $";
static const char rcsid[] = "$Id: except.c,v 1.2 2001/07/27 16:20:39 gram Exp $";
#endif
#define group except_group
@ -166,7 +166,7 @@ void except_deinit(void)
#endif
static int match(const except_id_t *thrown, const except_id_t *caught)
static int match(const volatile except_id_t *thrown, const except_id_t *caught)
{
int group_match = (caught->group == XCEPT_GROUP_ANY || caught->group == thrown->group);
int code_match = (caught->code == XCEPT_CODE_ANY || caught->code == thrown->code);
@ -367,7 +367,7 @@ static void bottom_level(void)
printf("throw exception? "); fflush(stdout);
fgets(buf, sizeof buf, stdin);
if (toupper(buf[0]) == 'Y')
if (buf[0] >= 0 && toupper(buf[0]) == 'Y')
except_throw(1, 1, "nasty exception");
}

View File

@ -14,7 +14,7 @@
* into proprietary software; there is no requirement for such software to
* contain a copyright notice related to this source.
*
* $Id: except.h,v 1.1 2000/09/27 04:54:50 gram Exp $
* $Id: except.h,v 1.2 2001/07/27 16:20:39 gram Exp $
* $Name: $
*/
@ -41,9 +41,9 @@ typedef struct {
} except_id_t;
typedef struct {
except_id_t except_id;
const char *except_message;
void *except_dyndata;
except_id_t volatile except_id;
const char *volatile except_message;
void *volatile except_dyndata;
} except_t;
struct except_cleanup {