forked from schierlm/Oberon2013Modifications
-
Notifications
You must be signed in to change notification settings - Fork 0
/
NoMemoryCorruptionAfterMemoryAllocationFailure.patch
47 lines (44 loc) · 1.35 KB
/
NoMemoryCorruptionAfterMemoryAllocationFailure.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
--- 1/Kernel.Mod.txt
+++ 2/Kernel.Mod.txt
@@ -41,8 +41,12 @@
VAR q: LONGINT;
BEGIN
IF list1 # 0 THEN p := list1; SYSTEM.GET(list1+8, list1)
- ELSE GetBlock(q, 256); SYSTEM.PUT(q+128, 128); SYSTEM.PUT(q+132, -1); SYSTEM.PUT(q+136, list1);
- list1 := q + 128; p := q
+ ELSE GetBlock(q, 256);
+ IF q # 0 THEN
+ SYSTEM.PUT(q+128, 128); SYSTEM.PUT(q+132, -1); SYSTEM.PUT(q+136, list1);
+ list1 := q + 128
+ END;
+ p := q
END
END GetBlock128;
@@ -50,8 +54,12 @@
VAR q: LONGINT;
BEGIN
IF list2 # 0 THEN p := list2; SYSTEM.GET(list2+8, list2)
- ELSE GetBlock128(q); SYSTEM.PUT(q+64, 64); SYSTEM.PUT(q+68, -1); SYSTEM.PUT(q+72, list2);
- list2 := q + 64; p := q
+ ELSE GetBlock128(q);
+ IF q # 0 THEN
+ SYSTEM.PUT(q+64, 64); SYSTEM.PUT(q+68, -1); SYSTEM.PUT(q+72, list2);
+ list2 := q + 64
+ END;
+ p := q
END
END GetBlock64;
@@ -59,8 +67,12 @@
VAR q: LONGINT;
BEGIN
IF list3 # 0 THEN p := list3; SYSTEM.GET(list3+8, list3)
- ELSE GetBlock64(q); SYSTEM.PUT(q+32, 32); SYSTEM.PUT(q+36, -1); SYSTEM.PUT(q+40, list3);
- list3 := q + 32; p := q
+ ELSE GetBlock64(q);
+ IF q # 0 THEN
+ SYSTEM.PUT(q+32, 32); SYSTEM.PUT(q+36, -1); SYSTEM.PUT(q+40, list3);
+ list3 := q + 32
+ END;
+ p := q
END
END GetBlock32;