acid/leak: fix endless loop for B2NB(b) == b case (thanks mischief)
This commit is contained in:
parent
5ca4afb249
commit
24d74a4b5f
2 changed files with 6 additions and 6 deletions
|
@ -41,8 +41,7 @@ dumparena(arena, sum)
|
||||||
if nb == b then {
|
if nb == b then {
|
||||||
print("B2NB(", b\A, ") = b\n");
|
print("B2NB(", b\A, ") = b\n");
|
||||||
b = atail; // end loop
|
b = atail; // end loop
|
||||||
}
|
} else if nb > atail then {
|
||||||
if nb > atail then {
|
|
||||||
b = (Bhdr)(b+4);
|
b = (Bhdr)(b+4);
|
||||||
print("lost at block ", (b-4)\A, ", scanning forward\n");
|
print("lost at block ", (b-4)\A, ", scanning forward\n");
|
||||||
while b < atail && b.magic != ALLOC_MAGIC && b.magic != FREE_MAGIC do
|
while b < atail && b.magic != ALLOC_MAGIC && b.magic != FREE_MAGIC do
|
||||||
|
|
|
@ -206,18 +206,19 @@ checkblock(addr)
|
||||||
defn
|
defn
|
||||||
checkarena(arena)
|
checkarena(arena)
|
||||||
{
|
{
|
||||||
local atail, b;
|
local atail, b, nb;
|
||||||
|
|
||||||
atail = A2TB(arena);
|
atail = A2TB(arena);
|
||||||
complex Bhdr arena;
|
complex Bhdr arena;
|
||||||
b = arena;
|
b = arena;
|
||||||
while b.magic != ARENATAIL_MAGIC && b < atail do {
|
while b.magic != ARENATAIL_MAGIC && b < atail do {
|
||||||
checkblock(b);
|
checkblock(b);
|
||||||
if B2NB(b) == b then {
|
nb = B2NB(b);
|
||||||
|
if nb == b then {
|
||||||
print("B2NB(", b\X, ") = b\n");
|
print("B2NB(", b\X, ") = b\n");
|
||||||
b = atail; // end loop
|
b = atail; // end loop
|
||||||
}
|
} else
|
||||||
b = B2NB(b);
|
b = nb;
|
||||||
}
|
}
|
||||||
|
|
||||||
checkblock(b);
|
checkblock(b);
|
||||||
|
|
Loading…
Reference in a new issue