0
0
mirror of https://github.com/netwide-assembler/nasm.git synced 2025-10-10 00:25:06 -04:00

Merge nasm-2.14

* commit '9a1216a1efa0ccb48e5df97acc763ea3de71e0ce':
  NASM 2.14
  nasmdoc.src: fix compound word
  doc: Add a description for a useful case of mangling symbols
  preproc: Don't access out of bound data on malformed input
  rdstrnum: Make sure we dont shift out of bound
  preproc: Fix out of bound access on malformed input
  doc: Clarify %include search directory semantics

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
Cyrill Gorcunov
2018-11-12 23:21:43 +03:00
4 changed files with 29 additions and 18 deletions

View File

@@ -2231,8 +2231,9 @@ static int do_directive(Token *tline, char **output)
skip_white_(tline);
if (!tline || !tok_type_(tline, TOK_PREPROC_ID) ||
(tline->text[1] == '%' || tline->text[1] == '$'
|| tline->text[1] == '!'))
(tline->text[0] && (tline->text[1] == '%' ||
tline->text[1] == '$' ||
tline->text[1] == '!')))
return NO_DIRECTIVE_FOUND;
i = pp_token_hash(tline->text);
@@ -3962,7 +3963,7 @@ static Token *expand_mmac_params(Token * tline)
thead = NULL;
while (tline) {
if (tline->type == TOK_PREPROC_ID &&
if (tline->type == TOK_PREPROC_ID && tline->text && tline->text[0] &&
(((tline->text[1] == '+' || tline->text[1] == '-') && tline->text[2]) ||
(tline->text[1] >= '0' && tline->text[1] <= '9') ||
tline->text[1] == '%')) {

View File

@@ -55,12 +55,14 @@ int64_t readstrnum(char *str, int length, bool *warn)
for (i = 0; i < length; i++) {
if (charconst & UINT64_C(0xFF00000000000000))
*warn = true;
charconst &= ~UINT64_C(0xFF00000000000000);
charconst = (charconst << 8) + (uint8_t)*--str;
}
} else {
for (i = 0; i < length; i++) {
if (charconst & 0xFF000000UL)
if (charconst & UINT32_C(0xFF000000))
*warn = true;
charconst &= ~UINT32_C(0xFF000000);
charconst = (charconst << 8) + (uint8_t)*--str;
}
}