parser: only use 32 bit next/check tables if required

If the state machine does not requires more than 2^16 states use the
dfa16 encoding for next/check tables to keep the dfa size small.

Bug: https://gitlab.com/apparmor/apparmor/-/issues/419
Signed-off-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
John Johansen 2024-08-14 09:06:12 -07:00
parent f86fda02f5
commit 012dcb6489

View file

@ -489,7 +489,8 @@ void flex_table_serialize(CHFA &chfa, ostream &os,
void CHFA::flex_table(ostream &os, optflags const &opts) {
if (opts.control & CONTROL_DFA_STATE32) {
if (opts.control & CONTROL_DFA_STATE32 &&
default_base.size() > (1 << 16) - 1) {
// TODO: implement support for flags in separate table
// if (opts.control & CONTROL_DFA_FLAGS_TABLE) {
// if (opts.dump & DUMP_FLAGS_TABLE)