Skip to content

fix potential invalid mmap call and uninitialized file size - #4559

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

richardsonnick wants to merge 3 commits into
meta:devfrom
richardsonnick:fix-zero-filesize-mmap

Conversation

@richardsonnick

@richardsonnick richardsonnick commented Dec 23, 2025 •

Copy link
Copy Markdown
Contributor

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

@terrelln terrelln left a comment

Copy link
Copy Markdown
Contributor

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!

Comment thread programs/fileio.c Resolved
@richardsonnick
richardsonnick force-pushed the fix-zero-filesize-mmap branch from 1fa208a to 01c8f60 Compare March 12, 2026 18:58
@richardsonnick
richardsonnick requested a review from terrelln March 21, 2026 18:12

This branch has not been deployed

No deployments
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