mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 08:24:42 +01:00
This is the user space fix for launchpad.net/busgs/599450
It changes the table resizing so that there is always sufficient high entries in the table, preventing bounds violations from occurring. Previously the resize allocation was always based on the character set range for a state, which could be more or less than actually required, and packing would waste some space when over allocation was done. As a result this patch in general results in slightly smaller transition tables even though it enforcing the minimum required padding to avoid bounds violations.
This commit is contained in:
parent
bfb96638f6
commit
837f47c921
1 changed files with 3 additions and 3 deletions
|
@ -2147,11 +2147,11 @@ repeat:
|
|||
x = free_list[x].second;
|
||||
}
|
||||
if (!x) {
|
||||
resize = cases.cases.rbegin()->first - cases.begin()->first + 1;
|
||||
resize = 256 - cases.begin()->first;
|
||||
x = free_list.size();
|
||||
/* set prev to last free */
|
||||
} else if (x + cases.cases.rbegin()->first + 1 - cases.begin()->first > next_check.size()) {
|
||||
resize = cases.cases.rbegin()->first + 1;
|
||||
} else if (x + 255 - cases.begin()->first >= next_check.size()) {
|
||||
resize = (255 - cases.begin()->first - (next_check.size() - 1 - x));
|
||||
for (size_t y = x; y; y = free_list[y].second)
|
||||
prev = y;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue