]> git.sur5r.net Git - cc65/commitdiff
AllocIf would overwrite memory if the .IF nesting became too deep.
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sun, 11 Aug 2002 14:49:42 +0000 (14:49 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sun, 11 Aug 2002 14:49:42 +0000 (14:49 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@1389 b7a2c559-68d2-44c3-8de9-860c34a00d81

src/ca65/condasm.c
src/ca65/error.c
src/ca65/error.h

index 68c1b181bbee50a7ca942857380b79c5189363c5..1f6f96cb30c653c66a2952af97bf7fe45a12bcfb 100644 (file)
@@ -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 */
index 849e5eb5f77ebd7018142181be2c3c897275d3b8..ba4de82697ef3b3ae206b4815a09e851daad71da 100644 (file)
@@ -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;
index 54e2ae1985a1dfdde98dfea7b01bdcacdb51930f..311b47c2a0047a7ed8c46923fde8b445924d7a37 100644 (file)
@@ -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 */
 };