summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2014-02-18 13:23:27 -0800
committerH. Peter Anvin <hpa@linux.intel.com>2014-02-18 13:30:44 -0800
commit0ace62cb6a45b2cd710220a82a9b197c9e30b4f9 (patch)
treec8ce8cc0efa766bfd65d8374b9038d5e95d9deb5
parent1eef781594b08a7f2d3a715f8f4fa4c28a29e65a (diff)
downloadnasm-0ace62cb6a45b2cd710220a82a9b197c9e30b4f9.tar.gz
nasm-0ace62cb6a45b2cd710220a82a9b197c9e30b4f9.tar.bz2
nasm-0ace62cb6a45b2cd710220a82a9b197c9e30b4f9.zip
outelf: Error out on "section align" without value
If someone specifies "section align" without =value, error out. Reported-by: Ilya Albrekht <ilya.albrekht@gmail.com> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r--output/outelf.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/output/outelf.c b/output/outelf.c
index bfbf625..61ae1fc 100644
--- a/output/outelf.c
+++ b/output/outelf.c
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------- *
*
- * Copyright 1996-2010 The NASM Authors - All Rights Reserved
+ * Copyright 1996-2014 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
*
@@ -76,15 +76,20 @@ void section_attrib(char *name, char *attr, int pass,
return;
while ((opt = nasm_opt_val(opt, &val, &next))) {
- if (!nasm_stricmp(opt, "align") && val) {
- *align = atoi(val);
- if (*align == 0) {
- *align = SHA_ANY;
- } else if (!is_power2(*align)) {
+ if (!nasm_stricmp(opt, "align")) {
+ if (!val) {
nasm_error(ERR_NONFATAL,
- "section alignment %"PRId64" is not a power of two",
- *align);
- *align = SHA_ANY;
+ "section align without value specified");
+ } else {
+ *align = atoi(val);
+ if (*align == 0) {
+ *align = SHA_ANY;
+ } else if (!is_power2(*align)) {
+ nasm_error(ERR_NONFATAL,
+ "section alignment %"PRId64" is not a power of two",
+ *align);
+ *align = SHA_ANY;
+ }
}
} else if (!nasm_stricmp(opt, "alloc")) {
*flags_and |= SHF_ALLOC;