From bd436acb4d4b754cb69e347ea44a058545610354 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Moln=C3=A1r?= Date: Mon, 18 Sep 2000 22:17:22 +0000 Subject: [PATCH] Added safety check for short jumps. committer: ml1050 969315442 +0000 --- src/linker.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/linker.cpp b/src/linker.cpp index 3aa79793..fbbe8803 100644 --- a/src/linker.cpp +++ b/src/linker.cpp @@ -55,7 +55,7 @@ Linker::Linker(const void *pdata, int plen, int pinfo) align_hack = 0; info = pinfo; njumps = nsections = frozen = 0; - jumps = new jump [200]; + jumps = new jump[200]; sections = new section[200]; char *p = iloader + info; @@ -173,6 +173,9 @@ const char *Linker::getLoader(int *llen) (jumps[ic].pos+jumps[ic].len - sections[jc].istart+sections[jc].ostart); + if (jumps[ic].len == 1) + assert(-128 <= offs && offs <= 127); + set_le32(&offs,offs); memcpy(oloader+sections[jc].ostart+jumps[ic].pos-sections[jc].istart,&offs,jumps[ic].len); }