Skip to content

Keyfile parsing performance improvements

Several improvements to parsing of key files, mostly in cases where the key file is invalid, but also in cases where there are a lot of translated values which the reader doesn’t case about, which is typical when loading desktop files.

This speeds up loading a particular 984KB key file (from oss-fuzz#31796) using the fuzz-key.c program, from originally taking 0.78s, to now taking 0.18s on my machine. (Not timed particularly rigorously.)

Marking as draft as this can’t land until we’ve branched (it changes strings, and is not a bugfix; we’re in code freeze), and its code coverage needs to be checked.

While this performance problem was highlighted by oss-fuzz, I don’t think this is a security issue. The way our fuzz-key.c test is written makes the performance 3 times worse than the bounds oss-fuzz puts on timeouts vs input file size (since fuzz-key.c runs three different parser tests on the same input).

oss-fuzz#31796

Edited by Philip Withnall

Merge request reports