You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Reader::open_mmap function is declared as a safe function that internally opens a file and calls MmapOptions::new().map(&file). The docs for MmapOptions say:
All file-backed memory map constructors are marked unsafe because of the potential for Undefined Behavior (UB) using the map if the underlying file is subsequently modified, in or out of process. Applications must consider the risk and take appropriate precautions when using file-backed maps. Solutions such as file permissions, locks or process-private (e.g. unlinked) files exist but are platform specific and limited.
maxminddb makes no effort in preventing the file from being modified from under it, leading to Reader::open_mmap being unsound. For the implementation to be sound the function must either be unsafe and require the user verify that their code abides by the memmap2 invariants, or effort to lock the file and make it read-only must be done.
The text was updated successfully, but these errors were encountered:
The
Reader::open_mmap
function is declared as a safe function that internally opens a file and callsMmapOptions::new().map(&file)
. The docs forMmapOptions
say:maxminddb
makes no effort in preventing the file from being modified from under it, leading toReader::open_mmap
being unsound. For the implementation to be sound the function must either beunsafe
and require the user verify that their code abides by thememmap2
invariants, or effort to lock the file and make it read-only must be done.The text was updated successfully, but these errors were encountered: