mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
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#662
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 @bp-cheng on GitHub (Jun 15, 2026).
Original GitHub issue: https://github.com/kvcache-ai/Mooncake/issues/2487
Originally assigned to: @bp-cheng on GitHub.
PR #2367 ("[Common][Store][TE] Fix undefined behavior passing signed char to
::tolower") fixed fourstd::transform(..., ::tolower)sites where a (possibly signed)charis passed to::tolower/::toupper. A byte > 0x7F sign-extends to a negativeint, which is UB for these functions (the argument must be representable asunsigned charor equalEOF).Three sibling occurrences on operator/CLI-controlled input were missed and are still present on current main (
9afefdb1):mooncake-transfer-engine/src/transport/tcp_transport/tcp_transport.cpp:606—std::transform(val.begin(), val.end(), val.begin(), ::tolower);on the value of env varMC_TCP_ENABLE_CONNECTION_POOL. (<cctype>is only available transitively here.)mooncake-store/include/utils.h:225—std::transform(unit.begin(), unit.end(), unit.begin(), ::toupper);on the unit suffix of a size string, fed by envMC_MMAP_ARENA_POOL_SIZE, theglobal_segment_sizeCLI flag, and config-map values. Note line 274 of this same file already uses the safe lambda idiom — line 225 was simply overlooked.mooncake-store/include/ha/oplog/oplog_store_factory.h:34—std::transform(lower.begin(), lower.end(), lower.begin(), ::tolower);on the HAoplog_store_typeconfig string. (<cctype>only transitively available.)All three take operator/attacker-controllable bytes (env vars, CLI flags, HA config), not kernel-generated ASCII like PCI bus IDs. Practical crash risk on glibc is low (its ctype tables span -128..255), but this is standard-defined UB that the project already chose to fix in #2367; these are the remaining sites that complete that sweep.
Will send a PR applying the same
[](unsigned char c) { return std::tolower(c); }idiom, adding<cctype>where it is only transitively available.@github-actions[bot] commented on GitHub (Jun 15, 2026):
Thanks for opening this issue, @bp-cheng!
194346132A maintainer will triage this when possible. To help us respond faster, please include:
Useful links: Documentation · Contributing guide