Skip to content

fix potential invalid mmap call and uninitialized file size#4559

Open
richardsonnick wants to merge 3 commits intofacebook:devfrom
richardsonnick:fix-zero-filesize-mmap
Open

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

Conversation

@richardsonnick
Copy link
Contributor

@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.

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
Copy link
Contributor

@terrelln terrelln left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor change, otherwise looks good. Thanks for the PR!

@richardsonnick richardsonnick force-pushed the fix-zero-filesize-mmap branch from 1fa208a to 01c8f60 Compare March 12, 2026 18:58
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.

2 participants