aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2010-06-05 01:58:10 +0400
committerCyrill Gorcunov <gorcunov@gmail.com>2010-06-05 01:58:10 +0400
commitc57eb515279d293d64f483724e8a4f18732185e9 (patch)
tree14b4c393a6554fb106d836b330104291eff40d90
parentc29404d7bad7308218ef04b8c22d4d9c54adbfad (diff)
downloadnasm-test-c57eb515279d293d64f483724e8a4f18732185e9.tar.gz
nasm-test-c57eb515279d293d64f483724e8a4f18732185e9.tar.xz
nasm-test-c57eb515279d293d64f483724e8a4f18732185e9.zip
preproc.c: Fix argument indices checking in parameters range
Otherwise %{-1:-1} fails. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
-rw-r--r--preproc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/preproc.c b/preproc.c
index 70933f86..0dfc3a43 100644
--- a/preproc.c
+++ b/preproc.c
@@ -3617,8 +3617,10 @@ static Token *expand_mmac_params_range(MMacro *mac, Token *tline, Token ***last)
goto err;
/* the values should be sane */
- if ((fst > mac->nparam || fst < -(int)mac->nparam) ||
- (lst > mac->nparam || lst < -(int)mac->nparam))
+ if ((fst > 0 && fst > mac->nparam) ||
+ (fst < 0 && fst < -(int)mac->nparam) ||
+ (lst > 0 && lst > mac->nparam) ||
+ (lst < 0 && lst < -(int)mac->nparam))
goto err;
fst = fst < 0 ? fst + mac->nparam + 1: fst;