2552 Commits

Author SHA1 Message Date
Cyrill Gorcunov
4794de2f5b NASM 2.09.03
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
nasm-2.09.03
2010-10-27 21:52:40 +04:00
Cyrill Gorcunov
fdbe8baf7a doc: Update changes for 2.09.03
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-10-27 21:50:20 +04:00
Cyrill Gorcunov
6cdc900d8d preproc.c: Restore concat rules on context local variables
This is a backport of commits

8dcbbd7af0d6d07b455de0b6460dca6db6113553
575d4289c9b1fb47774cb79764a24899a69a8d52

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-10-27 21:43:03 +04:00
Cyrill Gorcunov
0457bcbf2e preproc: Issue warning on unterminated %{ construct
As being pointed by "matching braces" topic on
[ http://forum.nasm.us/index.php?topic=905.0 ]
we don't issue warning on missed match for "{"
brace opened.

Strictly speaking we should issue error instead and
force user to fix asm source code but since it's
here for a long time already -- lets be "admissive".

Reported-by: Klod
CC: Frank Kotler <fbkotler@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-10-27 21:41:35 +04:00
Frank Kotler
582b3d0c70 BR3079777: Explain %00 in documentation
Signed-off-by: Frank Kotler <fbkotler@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-10-27 21:41:19 +04:00
Cyrill Gorcunov
2c157002f2 BR3079550: NASM crash on run-time for OMF output format
We could have accessed malloc'ed data on external symbols
in obj and ieee output formats. Fix it by using nasm_zalloc.

Reported-by: Jiri Malak
Patch-by: Jiri Malak
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-10-27 21:41:11 +04:00
Cyrill Gorcunov
71787fda1b BR3074517: Print %macro name inside %rep blocks
If we're to print inside %rep block we should find
out which %macro it belongs.

Reported-by: Rob Neff
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-10-27 21:40:59 +04:00
Cyrill Gorcunov
e0fdd77584 preproc: Issue warning on unterminated %{ construct
As being pointed by "matching braces" topic on
[ http://forum.nasm.us/index.php?topic=905.0 ]
we don't issue warning on missed match for "{"
brace opened.

Strictly speaking we should issue error instead and
force user to fix asm source code but since it's
here for a long time already -- lets be "admissive".

Reported-by: Klod
CC: Frank Kotler <fbkotler@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-10-07 19:42:12 +04:00
H. Peter Anvin
5129625225 Merge branch 'nasm-2.09.xx' 2010-10-06 16:28:43 -07:00
H. Peter Anvin
db6975919c doc: fix spelling of "compatibility"
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-10-06 16:28:07 -07:00
Cyrill Gorcunov
575d4289c9 preproc.c: Support multiple matches in paste_tokens
In mmacro params head TOK_NUM should be concat'ed with
tail TOK_NUM only, otherwise the weird construction like

    %define id1      1
    %define idid1    2
    %define TOK_NUM  1
    %define TOK_ID  id

    %macro m 2
        mov eax, 1%1id%2 ; this expands to 1idid1
                         ; where idid1 expands to 2
                         ; and then to 12
    %endmacro

    m TOK_ID, TOK_NUM

issue error.

N.B. I've checked nasm-0.98.39 and it compiles this macro
perfectly well, for the record.

Reported-by: nasm64developer@users.sf.net
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-10-07 01:16:26 +04:00
Frank Kotler
9d0701ecbf BR3079777: Explain %00 in documentation
Signed-off-by: Frank Kotler <fbkotler@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-10-05 18:41:11 +04:00
Cyrill Gorcunov
2405344e7b Add SubmittingPatches file
Adopted from Linux's Documentation/SubmittingPatches

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-10-03 21:02:08 +04:00
Cyrill Gorcunov
9e8f0ac460 BR3079550: NASM crash on run-time for OMF output format
We could have accessed malloc'ed data on external symbols
in obj and ieee output formats. Fix it by using nasm_zalloc.

Reported-by: Jiri Malak
Patch-by: Jiri Malak
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-10-02 01:21:00 +04:00
Cyrill Gorcunov
d4ddfac484 NASM 2.10rc1
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
nasm-2.10rc1
2010-09-30 22:45:57 +04:00
Cyrill Gorcunov
8dcbbd7af0 BR30730640: Restore preprocessor token concatenation rules
During nasm-2.06 development we broke the rules for
concatenation of preprocessor tokens (d784a083a3f1).

The former candidates for concatenation were (in terms of RE)

expand_smacro
    [(TOK_ID|TOK_PREPROC_ID)][(TOK_ID|TOK_PREPROC_ID|TOK_NUMBER)]

expand_mmac_params
    [(TOK_ID|TOK_NUMBER|TOK_FLOAT)][(TOK_ID|TOK_NUMBER|TOK_FLOAT|TOK_OTHER)]

[ nb: review commits ec88c1beac00 , 20a94ad7fe41 and 984279b1dde9 if
  you going to change this one ]

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-30 22:28:53 +04:00
Cyrill Gorcunov
4402af0c59 More tests automation
Not all covered but still worth to put in

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-30 22:10:34 +04:00
Cyrill Gorcunov
e6775697bb test: Add br3074517.asm
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-24 15:25:59 +04:00
Cyrill Gorcunov
4a35008733 BR3074517: Print %macro name inside %rep blocks
If we're to print inside %rep block we should find
out which %macro it belongs.

Reported-by: Rob Neff
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-24 15:24:42 +04:00
H. Peter Anvin
0e7370cfa6 phash: move sample function to the sample file
read_input() shouldn't be part of the phash.ph module; instead it
should go into the sample usage file phash.pl.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-09-22 14:02:28 -07:00
Cyrill Gorcunov
8fe1f65087 Merge branch 'nasm-2.09.xx' 2010-09-18 02:59:08 +04:00
Cyrill Gorcunov
af6be576ac NASM 2.09.02
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
nasm-2.09.02
2010-09-18 02:57:06 +04:00
Cyrill Gorcunov
a28db5f3c2 doc/changes.src: Describe changes
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-18 02:55:46 +04:00
Cyrill Gorcunov
ae7c916b6a Add test-case for BR3066383
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-18 02:48:53 +04:00
Cyrill Gorcunov
8bc8017df8 BR3066383: Restore backward compatibility with token pasting
It seems to be a bit long story for the reason if this bug. But
lets be verbose and describe all byte-to-byte. And it is all about
preprocessor code, in particular paste_tokens and expand_mmac_params.

Initially the problem (not the same but similar) was noticed and
fixed in commit ec88c1be. The problem reveals itself with code snippets
like

 | %macro m 1
 |  %push
 |      %define %$arg %1
 | %%top_%$arg:
 |      resb ($ - %%top_%$arg)
 |  %pop
 | %endmacro

So with commits ec88c1be, 51fd86e0, 1f6741fc, 985d880c we did expand
local single macro before processing tokens pasting unconditionally.

But then it being found that such approach breaks %assign directive.
The snippets like below didn't work

 | %macro m 1
 |  %push
 |      %assign %$arg %1
 |      %assign %$arg %1+%$arg
 |  %pop
 | %endmacro

So all these commits were reverted and we just stop pasting tokens
in paste_tokens() after TOK_PREPROC_ID (commit 20a94ad7). Unfortunately
this breaks %assign with compound preproc id

 | %macro m3 1
 |    %push
 |        %assign %$_uses 0
 |        %rep 4
 |            %assign %$_ur%$_uses %$_uses
 |            mov ecx, %$_ur%$_uses
 |            %assign %$_uses %$_uses+1
 |        %endrep
 |    %pop
 | %endmacro

To fix this bug we have to combine two approaches at once,
we should continue pasting after TOK_PREPROC_ID and expand
sequential TOK_PREPROC_IDs except first one.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-18 02:48:42 +04:00
Cyrill Gorcunov
14ad688d35 Merge branch 'nasm-2.09.xx' 2010-09-15 21:18:01 +04:00
Cyrill Gorcunov
831222f244 changes.src: Describe changes for 2.09.02
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-15 21:13:48 +04:00
Cyrill Gorcunov
cb6032340a BR3064376: ndisasm crash
ndisasm may crash due to lack of check of VEX table index.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-15 21:12:52 +04:00
Cyrill Gorcunov
530c1eddf5 BR3064459: Missing %endif doesn't always cause error
error() routine is conditional dependent so we should
use nasm_error instead to yield message unconditionally.

Reported-by: Christian Masloch
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-15 21:12:37 +04:00
Cyrill Gorcunov
ccba110e69 doc/nasmdoc.src: Fix octal number prefix misprint
Reported-by: Anthony <anthony@cloudnet.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-15 21:12:14 +04:00
H. Peter Anvin
c1ade75944 Merge branch 'nasm-2.09.xx' 2010-09-15 08:59:51 -07:00
H. Peter Anvin
2c11f97ca8 changes: document fixed token reversal for %deftok
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2010-09-15 08:59:12 -07:00
H. Peter Anvin
b40992c929 preproc: reverse the order of the tokens in %deftok
Smacros are apparently stored with the token stream reversed, so make
sure %deftok matches that sense of relatity.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2010-09-15 08:57:21 -07:00
Cyrill Gorcunov
84b4cbab54 preproc.c: Get rid of new TABs brought in recently
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-12 21:39:40 +04:00
Cyrill Gorcunov
9e1c9ce8e9 BR3064376: ndisasm crash
ndisasm may crash due to lack of check of VEX table index.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-12 13:37:53 +04:00
Cyrill Gorcunov
5ace91d681 BR3064459: Missing %endif doesn't always cause error
error() routine is conditional dependent so we should
use nasm_error instead to yield message unconditionally.

Reported-by: Christian Masloch
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-12 02:07:06 +04:00
Cyrill Gorcunov
9bcdd21efd doc/nasmdoc.src: Fix octal number prefix misprint
Reported-by: Anthony <anthony@cloudnet.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-10 22:40:27 +04:00
Cyrill Gorcunov
e2457c76d1 eval.c: Use OPFLAG_FORWARD instead of opencoded number
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-10 01:02:12 +04:00
Cyrill Gorcunov
55ce00907e Merge branches 'master' and 'nasm-2.09.xx' 2010-09-07 21:16:06 +04:00
Cyrill Gorcunov
e6e6a9ae2c NASM 2.09.01
A couple of NULL dereferences fixed.
See NASM version history in documentation.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
nasm-2.09.01
2010-09-07 21:00:19 +04:00
Cyrill Gorcunov
234e4edce7 changes.src: Describe changes for 2.09.01
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-07 20:57:36 +04:00
Cyrill Gorcunov
bf11db6aca preproc.c: Make %substr robust
Make %substr robust to handle -1,-1 parameters
and restore old behavior when number of characters
in substring is greater then length of string itself.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-07 20:55:03 +04:00
Cyrill Gorcunov
8fccbf33db Handle %substr invalid parameters preventing NULL dereference
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-07 20:54:50 +04:00
Cyrill Gorcunov
e165c1b69a nasm_quote: Use memcpy only if length provided
No need to call memcpy on empty strings

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-07 20:54:39 +04:00
Cyrill Gorcunov
cff031e1f7 preproc.c: Make %substr robust
Make %substr robust to handle -1,-1 parameters
and restore old behavior when number of characters
in substring is greater then length of string itself.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-07 20:31:11 +04:00
Cyrill Gorcunov
ab12287b4c Handle %substr invalid parameters preventing NULL dereference
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-07 19:10:15 +04:00
Cyrill Gorcunov
a26efa45d8 nasm_quote: Use memcpy only if length provided
No need to call memcpy on empty strings

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-07 19:10:10 +04:00
Cyrill Gorcunov
35519d6719 Fix NULL dereferences on %substr missing operands
%substr with dangling id issues SIGSEV. Fix it.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-07 00:11:47 +04:00
Cyrill Gorcunov
49cd6fbccf Fix NULL dereferences on %substr missing operands
%substr with dangling id issues SIGSEV. Fix it.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-07 00:10:23 +04:00
Cyrill Gorcunov
e12c50d274 BR3060469: Fix SIGSEV on missed %deftok second parameter
In case if a second parameter of %deftok is missed we hit
NULL dereference. Fix it.

Reported-by: Christian Masloch
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-09-06 19:44:51 +04:00