rt-link: reject frame offset at frame limit#11580
Conversation
The receive sequence filter maps incoming data-frame sequence numbers to zero-based frame offsets. RT_LINK_FRAMES_MAX is the maximum number of split frames, so valid offsets are 0 through RT_LINK_FRAMES_MAX - 1. Reject offset == RT_LINK_FRAMES_MAX before frame handling instead of letting it reach long-frame assembly. Generated-by: OpenAI Codex Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>
|
👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread! 为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。 🛠 操作步骤 | Steps
完成后,提交将自动更新至 如有问题欢迎联系我们,再次感谢您的贡献!💐 |
📌 Code Review Assignment🏷️ Tag: componentsReviewers: @Maihuanyi Changed Files (Click to expand)
📊 Current Review Status (Last Updated: 2026-07-07 09:21 CST)
📝 Review Instructions
|
What
Reject receive sequence offsets that are equal to
RT_LINK_FRAMES_MAXin the rt-link frame parser.Why
RT_LINK_FRAMES_MAXis documented as the maximum number of split frames for a long package.rt_link_send()rejectstotal > RT_LINK_FRAMES_MAX, so with the current value of 3 the valid zero-based receive offsets are 0, 1, and 2.The parser maps incoming data-frame sequence numbers to a zero-based
offsetbefore frame handling. The existingoffset > RT_LINK_FRAMES_MAXcheck still acceptsoffset == RT_LINK_FRAMES_MAX, which is outside the valid split-frame offset range.Testing
git diff --checkgit diff --check HEAD~1 HEADgit show --stat --check --format=fuller HEADgit ls-files --eol -- components/utilities/rt-link/src/rtlink.ctotal_count: 0for:repo:RT-Thread/rt-thread RT_LINK_FRAMES_MAX rt-link is:prrepo:RT-Thread/rt-thread RT_LINK_FRAMES_MAX rt-link is:issuerepo:RT-Thread/rt-thread rt_link_frame_check offset is:prrepo:RT-Thread/rt-thread rt_link_frame_check offset is:issueNot run locally:
make,scons,gcc,arm-none-eabi-gcc, andclangare not installed