summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-10-17test: nasm-t -- Add alonesym-obj testcaseCyrill Gorcunov
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-10-17test: nasm-t -- Use new syntax for updateCyrill Gorcunov
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-10-17travis: Disable osx for a whileCyrill Gorcunov
osx update takes too long, disable it for a while. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-10-17Add travis status into readmeCyrill Gorcunov
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-10-17test: travis -- Add some of converted testsCyrill Gorcunov
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-10-17test: travis -- Add initial supportCyrill Gorcunov
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-10-17README: Update link to licenseCyrill Gorcunov
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-10-17Convert README to md formatCyrill Gorcunov
And update it a bit. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-10-15Merge branch 'nasm-2.14.xx'Cyrill Gorcunov
* nasm-2.14.xx: (83 commits) NASM 2.14rc16 doc: Update changes preproc: expand_smacro -- Fix nil dereference on error path eval: Eliminate division by zero doc: Update changes opflags: Convert is_class and is_reg_class to helpers preproc: Fix out of range access in expand mmacro doc: Update changes parser: Fix sigsegv on certain equ instruction parsing labels: Make sure nil label is never passed labels: Don't nil dereference if no label provided macho: Add warning message in macho_output() macho/reloc: Fix addr size sensitive conditions macho/reloc: Fix macho_output() to get the offset adjustments by add_reloc() macho/reloc: Fixed offset adjustment in add_reloc() macho/reloc: Allow absolute relocation when forcing a symbol reference macho/reloc: Adjust SUB relocation information macho/reloc: Fixed in handling GOT/GOTLOAD/TLV relocations macho/reloc: Simplified relocation for REL/BRANCH macho/sym: Record initial symbol number always ... Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-10-15NASM 2.14rc16Cyrill Gorcunov
2018-10-14doc: Update changesCyrill Gorcunov
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-10-14preproc: expand_smacro -- Fix nil dereference on error pathCyrill Gorcunov
When error happened earlier we might have a.mac already handled and set to nil. https://bugzilla.nasm.us/show_bug.cgi?id=3392508 Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-10-14eval: Eliminate division by zeroCyrill Gorcunov
When doing division we should detect if the value we're divided by is not zero. Instead of is_unknown() helper we should use is_just_unknown(). https://bugzilla.nasm.us/show_bug.cgi?id=3392515 https://bugzilla.nasm.us/show_bug.cgi?id=3392473 Reported-by: Jun <jxx13@psu.edu> Reported-by: stuartly <situlingyun@gmail.com> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-10-13doc: Update changesCyrill Gorcunov
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-10-13opflags: Convert is_class and is_reg_class to helpersCyrill Gorcunov
So we can test for out of bound access and make helpers safe to use. https://bugzilla.nasm.us/show_bug.cgi?id=3392447 Reported-by: Jun <jxx13@psu.edu> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-10-13preproc: Fix out of range access in expand mmacroCyrill Gorcunov
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>
2018-10-13doc: Update changesCyrill Gorcunov
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-10-13parser: Fix sigsegv on certain equ instruction parsingCyrill Gorcunov
We should check for bounds when accessing nasm_reg_flags. Seems this bug was for long time already. https://bugzilla.nasm.us/show_bug.cgi?id=3392516 Reported-by: Jordan Zebor <j.zebor@f5.com> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-10-13labels: Make sure nil label is never passedCyrill Gorcunov
We already catched a case where we've missed test for non nil label and in result got sigsegv, lets rather panic next time. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-10-13labels: Don't nil dereference if no label providedCyrill Gorcunov
An equ without label may cause nil dereference | equ 0x100 Fixes 98578071b9d71ecaa2344dd9c185237c1765041e Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-10-09macho: Add warning message in macho_output()Chang S. Bae
Based-on-code-from: zenith432 <zenith432@users.sourceforge.net> Signed-off-by: Chang S. Bae <changseok.bae@gmail.com>
2018-10-09macho/reloc: Fix addr size sensitive conditionsChang S. Bae
TLVP relocation helps GOT that is 64-bit only. Based-on-code-from: zenith432 <zenith432@users.sourceforge.net> Signed-off-by: Chang S. Bae <changseok.bae@gmail.com>
2018-10-09macho/reloc: Fix macho_output() to get the offset adjustments by add_reloc()Chang S. Bae
Unlike the relative relocations, OUT_ADDRESS had ignored the adjustments made by add_reloc(), and writes the offset of the target symbol in the target section. Based-on-code-from: zenith432 <zenith432@users.sourceforge.net> Signed-off-by: Chang S. Bae <changseok.bae@gmail.com>
2018-10-09macho/reloc: Fixed offset adjustment in add_reloc()Chang S. Bae
If the target symbol is in the same file, add_reloc() emits an internal reloc for the target section, and the offset written is the offset in the target section. If the target symbol is external, its offset is zero (or an explicit addend), and add_reloc() emits an external reloc for the symbol. Based-on-code-from: zenith432 <zenith432@users.sourceforge.net> Signed-off-by: Chang S. Bae <changseok.bae@gmail.com>
2018-10-09macho/reloc: Allow absolute relocation when forcing a symbol referenceChang S. Bae
The (fake) section for absolute symbols is not in the linked list. So, when the section is not found from the index, now it simply points to the special section. Based-on-code-from: zenith432 <zenith432@users.sourceforge.net> Signed-off-by: Chang S. Bae <changseok.bae@gmail.com>
2018-10-09macho/reloc: Adjust SUB relocation informationChang S. Bae
As SUB relocation getting deprecated, reset external reference seems to be enough. Also, print a warning message for this. Based-on-code-from: zenith432 <zenith432@users.sourceforge.net> Signed-off-by: Chang S. Bae <changseok.bae@gmail.com>
2018-10-09macho/reloc: Fixed in handling GOT/GOTLOAD/TLV relocationsChang S. Bae
- Changed to search all symbols, instead of only global symbols. - Will do immediate exits when unsupported use of WRT - Fixed to mark (got)pcrel flag only for macho64 output. GOT is supported only for 64-bit. Based-on-code-from: zenith432 <zenith432@users.sourceforge.net> Signed-off-by: Chang S. Bae <changseok.bae@gmail.com>
2018-10-09macho/reloc: Simplified relocation for REL/BRANCHChang S. Bae
It seems like the relocation for the relative reference to absolute addresses only cares external reference info. Instead of exiting, reset the external reference flag. Based-on-code-from: zenith432 <zenith432@users.sourceforge.net> Signed-off-by: Chang S. Bae <changseok.bae@gmail.com>
2018-10-09macho/sym: Record initial symbol number alwaysChang S. Bae
The special segment may need this information for future fix-ups. Based-on-code-from: zenith432 <zenith432@users.sourceforge.net> Signed-off-by: Chang S. Bae <changseok.bae@gmail.com>
2018-10-01opflags: Style unificationCyrill Gorcunov
No func change. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-09-29preproc: parse_size -- Check for string providedCyrill Gorcunov
In case if the string is nil we will have sigsegv. https://bugzilla.nasm.us/show_bug.cgi?id=3392507 Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-09-24pspdf.pl: GhostScript font integration seems broken with -dSAFERH. Peter Anvin
-dSAFER seems to break font integration on some systems. Furthermore, once given -dSAFER seems to not be possible to override, so instead of calling via the ps2pdf script, call GhostScript explicitly with the equivalent options, sans -dSAFER. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-09-23doc: changes -- Add a few more bulletsCyrill Gorcunov
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-09-22Fix small typo in commentCyrill Gorcunov
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-09-22asm: Restore showing output for preproc mode in stdoutCyrill Gorcunov
Before the commit 81b62b9f54ac8e4019a9b2ec2b95ec0faa86bd2a we've been always putting -E,-e results into stdout if no output file provded. So bring this backward compatibility back. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-09-15obj: Fix to initialize segment listChang S. Bae
Recent labeling mechanism changes seem to bring the case, where segment() procedure is called when the segment list is empty. Now, it will simply check and initalize the segment list. Reported-by: Ozkan Sezer <sezeroz@gmail.com> Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
2018-08-24macho: Fix relocation type for relative direct branchChang S. Bae
Previously, X86_64_RELOC_BRANCH is only set for external relocations. Internal relocation also needs this type to be set, instead of the default (X86_64_RELOC_SIGNED) or anything. Reported-by: <zenith432@users.sourceforge.net> Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
2018-08-24doc: Fix macho section name for codeChang S. Bae
While today's manual lists "text" as the code section name, "code" has been effectively named from d1da074. Reported-by: <zenith432@users.sourceforge.net> Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
2018-08-16disasm: Fix buffer overread in ndisasmCyrill Gorcunov
https://nvd.nist.gov/vuln/detail/CVE-2018-10254 https://sourceforge.net/p/nasm/bugs/561/ Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-08-16macho: Turn off jump-match optimization for subsections_via_symbolsChang S. Bae
The jump-match optimization tends to remove labels. When the "subsections_via_symbols" pragma is declared, all the labels should be emitted. Disabling the optimization (only) makes the pragma effective. It might be cleaner to extend the OFMT interface to support callback function. In this case, the reconfiguration can be done through the callback interface, rather than direct access to the global variable. Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
2018-08-16optimization: Introduce new flag to turn-off selectivelyChang S. Bae
While configuring optimization in a level is conventional, a certain optimization tends to conflict with some pragma. For example, jump match conflicts with Mach-O's "subsections-via-symbols" macro. This configurability will workaround such conflicts. Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
2018-07-06NASM 2.14rc15H. Peter Anvin
2018-07-06float: fix bogus pass flags for errors and warningsH. Peter Anvin
Formatting errors -- syntax errors -- are errors, no matter which pass they end up in. ERR_PASS1 is just plain crazy: if we end up with a formatting error on the code-generation pass, we are in a world of hurt. Defer warnings to the code-generation pass; that's the pass which matters value-wise, and that way we get the warnings in the list file, too. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-07-06asm/float.c: fix buffer underflow in float parsingAdam Majer
When we suffer an underflow that cross limb boundaries, it is possible to end up with a stack underflow. Put in an explicit check for this case (the mantissa will be zero in this case.) https://bugzilla.nasm.us/show_bug.cgi?id=3392445 Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com> diff --git a/asm/float.c b/asm/float.c index dcf69fea..2965d3db 100644 --- a/asm/float.c +++ b/asm/float.c @@ -608,6 +608,8 @@ static void ieee_shr(fp_limb *mant, int i) if (offs) for (j = MANT_LIMBS-1; j >= offs; j--) mant[j] = mant[j-offs]; + } else if (MANT_LIMBS-1-offs < 0) { + j = MANT_LIMBS-1; } else { n = mant[MANT_LIMBS-1-offs] >> sr; for (j = MANT_LIMBS-1; j > offs; j--) {
2018-07-01labels: Add missing backend type for extern symbolsCyrill Gorcunov
Typo in 98578071b9d71ecaa2344dd9c185237c1765041e https://bugzilla.nasm.us/show_bug.cgi?id=3392494 Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-06-30labels: Shrink declare_labelCyrill Gorcunov
No need to pass unused 'created', find_label can handle nil here. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-06-28NASM 2.14rc14H. Peter Anvin (Intel)
2018-06-28assemble: defer MERR_OPSIZEMISSINGH. Peter Anvin (Intel)
In order for the machinery that deduces memory operand sizes when they are not provided to work correctly, we need to make sure that MERR_OPSIZEMISSING is only issued by matches() as the last resort; that way all other error conditions will have been filtered out and we know at the very end if we have exactly one option left. This is a partial revert of cd26fccab48bc35465e68d44a7432d1b1cca4d7e, but does not affect the functionality introduced by that patch. Reported-by: Cyrill Gorcunov <gorcunov@gmail.com> Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-06-27NASM 2.14rc13H. Peter Anvin (Intel)
2018-06-27asm: add a default-off warning for phase error in pass 1H. Peter Anvin (Intel)
Add a default-off warning for phase error in pass 1. This is default off because of the lateness in the release cycle, but cases where we have such instability should be investigated further. For now, the warning is here so we can debug these problems in the field. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>