summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--asm/nasm.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/asm/nasm.c b/asm/nasm.c
index 666c3375..ecab73be 100644
--- a/asm/nasm.c
+++ b/asm/nasm.c
@@ -105,6 +105,8 @@ static const char *listname;
static const char *errname;
static int globallineno; /* for forward-reference tracking */
+#define GLOBALLINENO_MAX INT32_MAX
+
/* static int pass = 0; */
const struct ofmt *ofmt = &OF_DEFAULT;
const struct ofmt_alias *ofmt_alias = NULL;
@@ -1342,7 +1344,10 @@ static void assemble_file(const char *fname, StrList **depend_ptr)
location.offset = offs = get_curr_offs();
while ((line = preproc->getline())) {
- globallineno++;
+ if (globallineno++ == GLOBALLINENO_MAX)
+ nasm_error(ERR_FATAL,
+ "overall line number reaches the maximum %d\n",
+ GLOBALLINENO_MAX);
/*
* Here we parse our directives; this is not handled by the