Make a public function to verify sanity of the database
- Dominant language
- C++
- Stars
- 5.5k
- Forks
- 816
- Avg merge
- 4d 21h
- Merged PRs (30d)
- 2
Description
We have found an issue when `mmap`-ing Hyperscan databases when a library version is changed. The full issue is here: https://github.com/rspamd/rspamd/issues/4409
The problem is that `hs_allocate_scratch` is an expensive call that should not be used to test database. And if it fails, it is hard to rewind the process of database compilation instead of loading a cached version.
Scratch allocation function uses [dbValid](https://github.com/intel/hyperscan/blob/v5.4.1/src/scratch.c#L254) to ensure that database is consistent. However, this function is not public. It would be super useful to have such a function in the public API to avoid migration issues when dealing with the mmap'ed databases.
Contributor guide
Assessment
This issue has not been assessed yet.