fixed bug #677841 by limiting the scanner to no more than 4095 characters for a single ID token
This commit is contained in:
parent
9aea715998
commit
c06f6df292
3 changed files with 9 additions and 2 deletions
3
labels.c
3
labels.c
|
@ -38,6 +38,9 @@
|
||||||
#define BOGUS_VALUE -4
|
#define BOGUS_VALUE -4
|
||||||
|
|
||||||
#define PERMTS_SIZE 4096 /* size of text blocks */
|
#define PERMTS_SIZE 4096 /* size of text blocks */
|
||||||
|
#if (PERMTS_SIZE > IDLEN_MAX)
|
||||||
|
#error "IPERMTS_SIZE must be less than or equal to IDLEN_MAX"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* values for label.defn.is_global */
|
/* values for label.defn.is_global */
|
||||||
#define DEFINED_BIT 1
|
#define DEFINED_BIT 1
|
||||||
|
|
2
nasm.h
2
nasm.h
|
@ -40,7 +40,7 @@
|
||||||
#define POSTFIX_MAX 10
|
#define POSTFIX_MAX 10
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define IDLEN_MAX 4096
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Name pollution problems: <time.h> on Digital UNIX pulls in some
|
* Name pollution problems: <time.h> on Digital UNIX pulls in some
|
||||||
|
|
|
@ -727,8 +727,12 @@ int stdscan (void *private_data, struct tokenval *tv)
|
||||||
}
|
}
|
||||||
|
|
||||||
r = stdscan_bufptr++;
|
r = stdscan_bufptr++;
|
||||||
|
/* read the entire buffer to advance the buffer pointer but... */
|
||||||
while (isidchar(*stdscan_bufptr)) stdscan_bufptr++;
|
while (isidchar(*stdscan_bufptr)) stdscan_bufptr++;
|
||||||
tv->t_charptr = stdscan_copy(r, stdscan_bufptr - r);
|
|
||||||
|
/* ... copy only up to IDLEN_MAX-1 characters */
|
||||||
|
tv->t_charptr = stdscan_copy(r, stdscan_bufptr - r < IDLEN_MAX ?
|
||||||
|
stdscan_bufptr - r : IDLEN_MAX - 1);
|
||||||
|
|
||||||
if (is_sym || stdscan_bufptr-r > MAX_KEYWORD)
|
if (is_sym || stdscan_bufptr-r > MAX_KEYWORD)
|
||||||
return tv->t_type = TOKEN_ID;/* bypass all other checks */
|
return tv->t_type = TOKEN_ID;/* bypass all other checks */
|
||||||
|
|
Loading…
Reference in a new issue