From 67f34936c275d2d450478633c6c3d9da55750247 Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Tue, 17 Dec 2019 12:43:37 -0500 Subject: [PATCH] check for code segments that exceed the bank size. --- link.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/link.cpp b/link.cpp index d0c0e56..1d808dd 100644 --- a/link.cpp +++ b/link.cpp @@ -506,6 +506,11 @@ static void resolve(void) { auto &seg = segments[ix]; auto &pending = relocations[ix]; + + if ((seg.kind & 0x0001) == 0x0001 && seg.data.size() > 65535) { + throw std::runtime_error("code exceeds bank"); + } + for (auto &r : pending) { assert(r.id < symbol_map.size()); const auto &e = symbol_table[r.id];