preproc: Fix out of range access in expand mmacro
On specially crafetd malformed input file the params might be zapped (say due to invalid syntax) so we might access out of bound having nil dereference in best case. Note the later code in this helper uses tok_isnt_ helper which already has similar check. https://bugzilla.nasm.us/show_bug.cgi?id=3392518 Reported-by: Jordan Zebor <j.zebor@f5.com> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
parent
a98a84b0d5
commit
67f2ca2b3f
1 changed files with 2 additions and 0 deletions
|
@ -3947,6 +3947,8 @@ static Token *expand_mmac_params_range(MMacro *mac, Token *tline, Token ***last)
|
|||
* only first token will be passed.
|
||||
*/
|
||||
tm = mac->params[(fst + mac->rotate) % mac->nparam];
|
||||
if (!tm)
|
||||
goto err;
|
||||
head = new_Token(NULL, tm->type, tm->text, 0);
|
||||
tt = &head->next, tm = tm->next;
|
||||
while (tok_isnt_(tm, ",")) {
|
||||
|
|
Loading…
Reference in a new issue