mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
[GH-ISSUE #2315] [Bug]: Environ::GetInt uses atoi with no error detection, opendir() leaks DIR* handle #633
Labels
No labels
ascend
auto-closed
bug
bug
CI/Build
Common
documentation
enhancement
feature request
good first issue
help wanted
high priority
MetaX
nightly-failure
pull-request
PyTorch Backend
question
RFC
Roadmap
stale
Store
Tests
Transfer Engine
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/Mooncake#633
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jfeng18 on GitHub (Jun 3, 2026).
Original GitHub issue: https://github.com/kvcache-ai/Mooncake/issues/2315
Description
1.
Environ::GetIntusesstd::atoiwith no error detectionEnviron::GetInt()inmooncake-common/src/environ.cppusesstd::atoi()which returns 0 on parse failure and has undefined behavior on overflow. SettingMC_MAX_WR=abcsilently yields 0 instead of the intended default (256). All 35+MC_*environment variables parsed throughGetInt/GetSizeTare affected.Additionally,
GetSizeTusesstrtoullwhich silently wraps negative values:MC_SLICE_SIZE=-1would set slice_size to ~18 exabytes (ULLONG_MAX) instead of the default.2.
opendir()handle leaked inloadGlobalConfig()config.cppline 273 callsopendir(log_dir_path)to check if a directory exists, but the returnedDIR*is neverclosedir()'d, leaking one file descriptor per process.3.
.ymlextension not recognized byDefaultConfig::Load()DefaultConfig::Load()only recognizes.yamlbut not.yml, which is equally common.Impact
.ymlconfig files rejected with "Unsupported config file format"Environment
All platforms. The
Environsingleton is used across the entire codebase.