Skip to content

fix potential invalid mmap call and uninitialized file size#4559

Open
richardsonnick wants to merge 1 commit intofacebook:devfrom
richardsonnick:fix-zero-filesize-mmap
Open

fix potential invalid mmap call and uninitialized file size#4559
richardsonnick wants to merge 1 commit intofacebook:devfrom
richardsonnick:fix-zero-filesize-mmap

Conversation

@richardsonnick
Copy link

@richardsonnick richardsonnick commented Dec 23, 2025

Fixes a warning from Clang 21 (unix.StdCLibraryFunctions) where mmap() could be called with a length of 0 if the dictionary file is empty. Mapping a zero-length range is undefined behavior under POSIX.

  • Added guard for zero-length dictionary files.

Reported-by: Clang 21 Static Analyzer

Fixes a warning from Clang 21 (unix.StdCLibraryFunctions) where mmap()
could be called with a length of 0 if the dictionary file is empty.
Mapping a zero-length range is undefined behavior under POSIX.

- Added guard for zero-length dictionary files.
@meta-cla meta-cla bot added the CLA Signed label Dec 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant