Added safety check for short jumps.

committer: ml1050 <ml1050> 969315442 +0000
This commit is contained in:
László Molnár
2000-09-18 22:17:22 +00:00
parent 400489aa55
commit bd436acb4d
+4 -1
View File
@@ -55,7 +55,7 @@ Linker::Linker(const void *pdata, int plen, int pinfo)
align_hack = 0; align_hack = 0;
info = pinfo; info = pinfo;
njumps = nsections = frozen = 0; njumps = nsections = frozen = 0;
jumps = new jump [200]; jumps = new jump[200];
sections = new section[200]; sections = new section[200];
char *p = iloader + info; char *p = iloader + info;
@@ -173,6 +173,9 @@ const char *Linker::getLoader(int *llen)
(jumps[ic].pos+jumps[ic].len - (jumps[ic].pos+jumps[ic].len -
sections[jc].istart+sections[jc].ostart); sections[jc].istart+sections[jc].ostart);
if (jumps[ic].len == 1)
assert(-128 <= offs && offs <= 127);
set_le32(&offs,offs); set_le32(&offs,offs);
memcpy(oloader+sections[jc].ostart+jumps[ic].pos-sections[jc].istart,&offs,jumps[ic].len); memcpy(oloader+sections[jc].ostart+jumps[ic].pos-sections[jc].istart,&offs,jumps[ic].len);
} }