Commit Graph

4047 Commits

Author SHA1 Message Date
H. Peter Anvin
a0ed5b3ffa Merge branch 'master' of ssh://repo.or.cz/nasm 2018-11-28 09:56:15 -08:00
Cyrill Gorcunov
295b795d71 preproc: Use error helpers
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-25 13:09:53 +03:00
Cyrill Gorcunov
00526d9845 assemble: Use nasm_ error helpers
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-25 01:45:49 +03:00
Cyrill Gorcunov
c3527dd6b2 error: Cover all levels with helpers
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-25 01:15:51 +03:00
Cyrill Gorcunov
3351072306 error: Style liftup
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-24 18:58:11 +03:00
Cyrill Gorcunov
85261a2b57 test: Use NASM_TEST_RUN environment
To placate false positives in outputs which
writes nasm comment an signature into binary
form.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-24 17:06:57 +03:00
Cyrill Gorcunov
f6b1720a2d version: Make them dynamic for regression tests sake
When we are running regression tests we compare binary
forms and the strings better to be the constants to not
trigger false positives.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-24 16:59:32 +03:00
Cyrill Gorcunov
8c0666b0e6 preproc: Pass include paths as strlist
Instead of copying data just reuse already
allocated paths.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-24 14:33:48 +03:00
Cyrill Gorcunov
b7bb5acdaf strlist: Rework to drop type
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-24 13:24:09 +03:00
Cyrill Gorcunov
8e0acaad66 Pass input filename into error message
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-24 12:12:15 +03:00
Cyrill Gorcunov
afd8d2f11a test: nasm-t -- Test for sigsegv on multiple outputs
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-24 12:12:15 +03:00
Cyrill Gorcunov
f5a48a6ba2 Fix sigsegv if two outputs specified
outname is only set up by pass two so
earlier access may lead to sigsegv.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-24 12:02:13 +03:00
Cyrill Gorcunov
744100dc14 Merge branch 'nasm-2.14.xx'
* nasm-2.14.xx:
  Fix undefined behavior when shifting left by 32 bits
  BR 3392529: if the default output name is the same as input -> nasm.out
2018-11-23 23:52:11 +03:00
Michael Bradshaw
fd14310469 Fix undefined behavior when shifting left by 32 bits
See https://bugzilla.nasm.us/show_bug.cgi?id=3392368

Signed-off-by: Michael Bradshaw <mjbshaw@google.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-23 23:51:16 +03:00
H. Peter Anvin (Intel)
7b6371b9d3 BR 3392529: if the default output name is the same as input -> nasm.out
If no output filename is specified, then a default filename is used
based on the input filename. If that ends up the *same* as the input
filename, change the output filename to "nasm.out".

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-11-20 10:56:57 -08:00
Cyrill Gorcunov
69f77d5c34 test: nasm-t -- Add br3392528
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-14 10:26:26 +03:00
Cyrill Gorcunov
3079f7966d preproc: Fix malformed parameter count
readnum returns 64bit number which may become
a negative integer upon conversion which in
turn lead to out of bound array access.

Fix it by explicit conversion with bounds check

 | POC6:2: error: parameter count `2222222222' is out of bounds [0; 2147483647]

https://bugzilla.nasm.us/show_bug.cgi?id=3392528

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-14 10:26:26 +03:00
Cyrill Gorcunov
feabd742a3 preproc_init: Just clean include path
It is more natural to keep include path valid
during the whole lifetime.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-13 01:23:47 +03:00
Cyrill Gorcunov
e358851526 Merge branch 'nasm-2.14.xx'
* nasm-2.14.xx:
  preproc: command-line preproc directive after system-generated

gorcunov@: Had to fix include_path StrList conversion,
it is a bit ugly by now, will rework.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-13 01:09:27 +03:00
Cyrill Gorcunov
fcc85aeef7 test: nasm-t -- Extend inctest
To address https://bugzilla.nasm.us/show_bug.cgi?id=3392527

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-12 23:28:18 +03:00
Cyrill Gorcunov
0135a8147e 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>
2018-11-12 23:21:43 +03:00
H. Peter Anvin
bf6230baa9 preproc: command-line preproc directive after system-generated
BR 3392527: make sure that all command-line specified preprocessing
directives are processed after the system-generated ones. In
particular __OUTPUT_FORMAT__ was generated after command line pass 2,
at which point -p, -d, -u, --pragma and --before had already been
processed.

There is no reason to split up defined_macros() anymore: the right
place to execute it is simply between command line passes 1 and 2. We
can also set dfmt here, which lets us define a __DEBUG_FORMAT__ macro
as well.

Finally move some options that have no business being processed in
pass 2 to pass 1.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-11-11 13:36:13 -08:00
Cyrill Gorcunov
7373a8e606 test: nasm-t -- Add br560575
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-11 21:43:46 +03:00
Cyrill Gorcunov
9354f72a41 test: nasm-t -- Add br978756
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-11 21:43:46 +03:00
Cyrill Gorcunov
634b0e405b test: nasm-t -- Add br3392259
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-11 21:43:46 +03:00
Cyrill Gorcunov
f9e3e8168b test: nasm-t -- Add br3392252
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-11 21:43:46 +03:00
Cyrill Gorcunov
6fcb91cbc1 test: nasm-t -- Add br3200749
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-11 21:43:46 +03:00
Cyrill Gorcunov
3d5195704d test: nasm-t -- Add br3385573
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-11 21:43:46 +03:00
Cyrill Gorcunov
e8d773c578 test: nasm-t -- Add br3189064
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-11 21:43:46 +03:00
Cyrill Gorcunov
679a470aa7 test: nasm-t -- Add br3187743
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-11 21:43:46 +03:00
Cyrill Gorcunov
f4c33801a2 test: nasm-t -- Add br3174983
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-11 21:43:46 +03:00
Cyrill Gorcunov
a138610100 test: nasm-t -- Add br3109604
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-11 21:43:46 +03:00
Cyrill Gorcunov
323f5ae765 test: nasm-t -- Add br3066383
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-11 21:43:46 +03:00
Cyrill Gorcunov
27fe12d46e test: nasm-t -- Add br3058845
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-11 21:43:46 +03:00
Cyrill Gorcunov
3402778330 test: nasm-t -- Add br3041451
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-11 21:43:46 +03:00
Cyrill Gorcunov
0feb41b087 test: nasm-t -- Add br3028880
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-11 21:43:46 +03:00
Cyrill Gorcunov
0f26c1ec54 test: nasm-t -- Add ability to pass environ variables to test
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-11 21:43:46 +03:00
Cyrill Gorcunov
292d728974 test: nasm-t -- Add br3026808
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-11 21:43:46 +03:00
Cyrill Gorcunov
7c37fae21d test: nasm-t -- Add br890790
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-11 21:43:46 +03:00
Cyrill Gorcunov
6ad457d6f8 test: nasm-t -- Add br2222615
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-11 21:43:46 +03:00
Cyrill Gorcunov
c51934e40f test: nasm-t -- Add nasmformat
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-11 21:43:46 +03:00
Cyrill Gorcunov
7af13e0466 test: nasm-t -- Add multisection
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-11 21:43:46 +03:00
Cyrill Gorcunov
7fd2389637 test: nasm-t -- Add macro-defaults
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-11 21:43:46 +03:00
Cyrill Gorcunov
fa747e71a8 test: nasm-t -- Add lnxhello
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-11 21:43:46 +03:00
Cyrill Gorcunov
88ef14eed8 test: nasm-t -- Add ifelse
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-11 21:43:46 +03:00
Cyrill Gorcunov
b93462b8f7 test: nasm-t -- Add expimp
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-11 21:43:46 +03:00
Cyrill Gorcunov
c777772243 test: nasm-t -- Add elif
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-11 21:43:46 +03:00
Cyrill Gorcunov
b87a996ef0 test: nasm-t -- Add imul
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-11 21:43:46 +03:00
Cyrill Gorcunov
bfe17213e0 test: nasm-t -- Add immwarn
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-11 21:43:46 +03:00
Cyrill Gorcunov
752c72e204 test: nasm-t -- Add imm64
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-11 21:43:46 +03:00