aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2021-02-21 01:05:28 +0300
committerCyrill Gorcunov <gorcunov@gmail.com>2021-02-21 01:05:28 +0300
commit8c735c58d191c217d75a8137a850ffc56cd4a269 (patch)
treee8fd856bcc7828b194d382204b6db5809d8fbcbb
parent79ac0d686dbf99758c9589fc4db6be4a2c5476e4 (diff)
downloadnasm-8c735c58d191c217d75a8137a850ffc56cd4a269.tar.gz
nasm-8c735c58d191c217d75a8137a850ffc56cd4a269.tar.xz
nasm-8c735c58d191c217d75a8137a850ffc56cd4a269.zip
BR3392739: output/outbin: fix nil dereference for self following sections
In case if section follows itself we should yield an error, otherwise we hit nil dereference because there won't be any group of sections. After all "follow" attribute is rather to group sections other than self. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
-rw-r--r--output/outbin.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/output/outbin.c b/output/outbin.c
index 3e09005e..2ceec7d1 100644
--- a/output/outbin.c
+++ b/output/outbin.c
@@ -335,6 +335,8 @@ static void bin_cleanup(void)
if (!s)
nasm_fatal("section %s follows an invalid or"
" unknown section (%s)", g->name, g->follows);
+ if (s == g)
+ nasm_fatal("section %s is self following", s->name);
if (s->next && (s->next->flags & FOLLOWS_DEFINED) &&
!strcmp(s->name, s->next->follows))
nasm_fatal("sections %s and %s can't both follow"