Skip to content

Commit 5a88dd3

Browse files
committed
TooManyLiveRegs check: fix break that was broken by allocator change.
In #196, various `break`s and early returns` out of a main allocator loop were changed to pass through a point that returned scratch storage to a context for later reuse. Unfortunately, this refactor introduced a bug: a `break` became a `break 'outer`, and the latter meant that we were skipping some checks. Fortunately this only happens in a code-path where the given allocation problem has too many constraints, and it means that we get a panic rather than a `TooManyLiveRegs` error cleanly returned, so this is not a security issue. However, it has me a little paranoid and we should carefully re-audit #196's changes when we get a chance. (Discovered while making changes to ABI code that caused too many defs constrained to regs, resulting in an un-allocatable input; not reachable from mainline Cranelift.)
1 parent 925df1b commit 5a88dd3

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/ion/process.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,8 +1258,7 @@ impl<'a, F: Function> Env<'a, F> {
12581258
continue;
12591259
}
12601260
if preg_range.from >= range.to {
1261-
// Success, return scratch memory to context and finish
1262-
break 'outer;
1261+
break;
12631262
}
12641263
if lr.is_valid() {
12651264
if self.minimal_bundle(self.ranges[*lr].bundle) {

0 commit comments

Comments
 (0)