fixed an access violation in case of a script jump beyond the last entry

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3772 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2004-11-19 15:02:08 +00:00
parent 821fca5066
commit 75b4c66de6

View file

@ -1305,6 +1305,7 @@ int CEXEBuild::resolve_jump_int(const char *fn, int *a, int offs, int start, int
{ {
int jump = atoi(lname); int jump = atoi(lname);
int *skip_map = (int *) cur_instruction_entry_map->get(); int *skip_map = (int *) cur_instruction_entry_map->get();
int maxoffs = cur_instruction_entry_map->getlen() / (int) sizeof(int);
int direction = 1; int direction = 1;
if (jump < 0) if (jump < 0)
@ -1313,7 +1314,7 @@ int CEXEBuild::resolve_jump_int(const char *fn, int *a, int offs, int start, int
for (; jump != 0; jump -= direction) for (; jump != 0; jump -= direction)
{ {
offs += direction; offs += direction;
if (offs >= 0 && offs < cur_instruction_entry_map->getlen() * (int) sizeof(int)) if (offs >= 0 && offs < maxoffs)
{ {
while (skip_map[offs]) while (skip_map[offs])
{ {