mirror of
https://github.com/cc65/cc65.git
synced 2024-11-19 06:31:31 +00:00
AllocIf would overwrite memory if the .IF nesting became too deep.
git-svn-id: svn://svn.cc65.org/cc65/trunk@1389 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
b286cdf2b4
commit
4db7198ade
@ -70,7 +70,7 @@ enum {
|
||||
|
||||
/* One .IF descriptor */
|
||||
typedef struct IfDesc IfDesc;
|
||||
struct IfDesc {
|
||||
struct IfDesc {
|
||||
unsigned Flags; /* Bitmapped flags, see above */
|
||||
FilePos Pos; /* File position of the .IF */
|
||||
const char* Name; /* Name of the directive */
|
||||
@ -89,7 +89,7 @@ static IfDesc* AllocIf (const char* Directive, int NeedTerm)
|
||||
|
||||
/* Check for stack overflow */
|
||||
if (IfCount >= MAX_IFS) {
|
||||
Error (ERR_IF_NESTING);
|
||||
Fatal (FAT_IF_NESTING);
|
||||
}
|
||||
|
||||
/* Alloc one element */
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998-2000 Ullrich von Bassewitz */
|
||||
/* (C) 1998-2002 Ullrich von Bassewitz */
|
||||
/* Wacholderweg 14 */
|
||||
/* D-70597 Stuttgart */
|
||||
/* EMail: uz@musoftware.de */
|
||||
@ -168,7 +168,6 @@ void ErrorMsg (const FilePos* Pos, unsigned ErrNum, va_list ap)
|
||||
"Symbol `%s' is already marked as export",
|
||||
"Exported symbol `%s' is undefined",
|
||||
"Exported values must be constant",
|
||||
".IF nesting too deep",
|
||||
"Unexpected end of file",
|
||||
"Unexpected end of line",
|
||||
"Unexpected `%s'",
|
||||
@ -257,6 +256,7 @@ void Fatal (unsigned FatNum, ...)
|
||||
"Cannot write to listing file: %s",
|
||||
"Cannot read from listing file: %s",
|
||||
"Too many nested constructs",
|
||||
".IF nesting too deep",
|
||||
"Too many symbols",
|
||||
};
|
||||
va_list ap;
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998-2000 Ullrich von Bassewitz */
|
||||
/* (C) 1998-2002 Ullrich von Bassewitz */
|
||||
/* Wacholderweg 14 */
|
||||
/* D-70597 Stuttgart */
|
||||
/* EMail: uz@musoftware.de */
|
||||
@ -109,7 +109,6 @@ enum Errors {
|
||||
ERR_SYM_ALREADY_EXPORT,
|
||||
ERR_EXPORT_UNDEFINED,
|
||||
ERR_EXPORT_MUST_BE_CONST,
|
||||
ERR_IF_NESTING,
|
||||
ERR_UNEXPECTED_EOF,
|
||||
ERR_UNEXPECTED_EOL,
|
||||
ERR_UNEXPECTED,
|
||||
@ -148,6 +147,7 @@ enum Fatals {
|
||||
FAT_CANNOT_WRITE_LISTING,
|
||||
FAT_CANNOT_READ_LISTING,
|
||||
FAT_NESTING,
|
||||
FAT_IF_NESTING,
|
||||
FAT_TOO_MANY_SYMBOLS,
|
||||
FAT_COUNT /* Fatal error count */
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user