Repository navigation
fix: SetPart 范围校验与 reserved 硬错(配合 kvlang body 直写收紧) - #46
Merged
Merged
Conversation
- kvspaceSetPart:reserved key 硬错;offset 必须在 body 区 [8, 8+len), 越界直接报错,不再交给底层静默处理 - kvspaceWriteInPlace / kvspaceWriteNewPlace:body 指针 8 字节对齐改为 debug_assert(这是前条件,不是假设) 对端:kvlang #607 的 body 直写改用 head 声明长度。 Co-Authored-By: Claude Code <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
与 kvlang
runtimec2侧配套的收紧:SetPart只允许改 body。对端
kvlang #607(body 直写改用 head 声明长度)与 #616(复合描述符)。单边合入会让「原地写只改 body」的契约半成立 —— runtime 按 head 长度写、后端仍放行任意 offset 时,越界不会被拦住。
内容(1 文件,+34/−2)
kvspaceSetPart:reserved key 硬错;offset 必须落在 body 区[8, 8+len),越界直接报错,不再交给底层静默处理kvspaceWriteInPlace/kvspaceWriteNewPlace:body 指针 8 字节对齐改为debug_assert(这是前条件,不是假设)双向证据(同一段调用,
fs后端)本仓补丁没有新增测试文件,我用一次性 ABI 测试分别在两个版本上验证:
先
kvspaceConnect、写入/k(int64=7),再kvspaceSetPart(offset=0)(head 区)与kvspaceSetPart(offset=8)(body 区)。旧版本(
b2eea59)本补丁
即:head 区写从「被放行」变为「硬错」,body 区写仍然正常。
回归
cargo test --release --offline全绿(7 个测试二进制,test result: ok)。说明:
debug_assert只在 debug 构建生效,release 下不改变行为。🤖 Generated with Claude Code