Repository navigation
Conversation
|
👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread! 为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。 🛠 操作步骤 | Steps
完成后,提交将自动更新至 如有问题欢迎联系我们,再次感谢您的贡献!💐 |
📌 Code Review Assignment🏷️ Tag: kernelReviewers: @GorrayLi @ReviewSun @hamburger-os @lianux-mm @wdfk-prog @xu18838022837 Changed Files (Click to expand)
📊 Current Review Status (Last Updated: 2026-11-19 04:13 CST)
📝 Review Instructions
|
|
BernardXiong
left a comment
There was a problem hiding this comment.
复核 / Review
复核 184ba862:src/dest 扩到 11 字节后,原来的越界读写已消除,改动本身正确。CI 全绿。
非阻塞 / Non-blocking — 该用例不再能发现“拷贝长度超过 NUL”的回归。
TC_rt_memmove.c:74-80 中 src[11] = "Short" 的 5..10 字节全部为 0,dest[11] = {0} 也全为 0;即使 rt_memmove() 错误地只拷贝到 NUL 为止,两条断言仍会通过,用例名 too_long 实际不再覆盖 n > strlen 的语义。
建议(二选一):
- 保留回归意图:把
src尾部填非零值(例如{'S','h','o','r','t',0,'X','Y','Z','W','V'}),dest预填0xAA,再断言 5..10 字节与src一致; - 若只想验证零填充拷贝,则改名为
TC_rt_memmove_zero_padding或删除该用例。
The assertions can no longer distinguish a memmove that stops at NUL, since both the source tail and destination are zeroed. Either use a non-zero tail with a 0xAA-filled destination, or rename/remove the case.
The test copied 11 bytes from a 6-byte source into a 10-byte buffer. It corrupted the stack at -O2 on RH850. Copy 11 bytes between 11-byte buffers. Also check the bytes past the NUL, so a copy that stops early fails. Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
184ba86 to
918d202
Compare
Thanks for the review @BernardXiong, went with option 1. src now has a non-zero tail, dest is filled with 0xAA, and all 11 bytes are compared, so a copy that stops at NUL fails now. Kindly revisit. |
TC_rt_memmove_too_long copies 11 bytes from a 6-byte source into a 10-byte buffer, so it reads and writes past both arrays. Use 11-byte buffers. The assertions are unchanged.
Test: RH850 qemu-rh850-u2c kernel_basic at -O2: the stack corruption crashed the run in rt_memmove before, 22/22 pass after.