mirror of
https://github.com/netwide-assembler/nasm.git
synced 2024-11-27 08:10:07 +08:00
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
labels.c
3
labels.c
@ -38,6 +38,9 @@
|
||||
#define BOGUS_VALUE -4
|
||||
|
||||
#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 */
|
||||
#define DEFINED_BIT 1
|
||||
|
2
nasm.h
2
nasm.h
@ -40,7 +40,7 @@
|
||||
#define POSTFIX_MAX 10
|
||||
#endif
|
||||
|
||||
|
||||
#define IDLEN_MAX 4096
|
||||
|
||||
/*
|
||||
* 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++;
|
||||
/* read the entire buffer to advance the buffer pointer but... */
|
||||
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)
|
||||
return tv->t_type = TOKEN_ID;/* bypass all other checks */
|
||||
|
Loading…
Reference in New Issue
Block a user