Skip to content

Commit dfce4bd

Browse files
committed
COMMON: Fixed memory issue related to SUB/FUNC pointers
1 parent 08c478b commit dfce4bd

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
2016-04-20 (0.12.6)
22
Fixed memory handling issues with UNITs
3+
Fixed memory issue related to SUB/FUNC pointers
34

45
2016-03-29 (0.12.6)
56
Removed TICKSPERSEC

src/common/scan.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3090,14 +3090,15 @@ void comp_pass2_scan() {
30903090
case kwTYPE_PTR:
30913091
case kwTYPE_CALL_UDP:
30923092
case kwTYPE_CALL_UDF:
3093-
// update real IP
30943093
memcpy(&label_id, comp_prog.ptr + node->pos + 1, ADDRSZ);
3095-
true_ip = comp_udptable[label_id].ip + (ADDRSZ + 3);
3096-
memcpy(comp_prog.ptr + node->pos + 1, &true_ip, ADDRSZ);
3097-
3098-
// update return-var ID
3099-
true_ip = comp_udptable[label_id].vid;
3100-
memcpy(comp_prog.ptr + node->pos + (ADDRSZ + 1), &true_ip, ADDRSZ);
3094+
if (label_id != kwCALLCF) {
3095+
// update real IP
3096+
true_ip = comp_udptable[label_id].ip + (ADDRSZ + 3);
3097+
memcpy(comp_prog.ptr + node->pos + 1, &true_ip, ADDRSZ);
3098+
// update return-var ID
3099+
true_ip = comp_udptable[label_id].vid;
3100+
memcpy(comp_prog.ptr + node->pos + (ADDRSZ + 1), &true_ip, ADDRSZ);
3101+
}
31013102
break;
31023103

31033104
case kwONJMP:

0 commit comments

Comments
 (0)