This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 52bfdc3cf440732259ca03c50b6e2b0903fef94e Author: huojianchao <[email protected]> AuthorDate: Tue Oct 13 20:04:14 2026 +0800 drivers/note: bound the noterpmsg batch by the padded length noterpmsg_transfer() fills an rpmsg payload with as many whole notes as fit. It tested the unaligned nc_length against the space left while accumulating the padded stride, so len could end up to seven bytes past the payload it was measured against, and both the memcpy and the rpmsg_send_nocopy() that follow run on that oversized len. space=36 with a 33-byte note is enough: the test passes at 33 and len becomes 40. Simulating the ring over random note lengths and payload capacities trips an assertion on len <= space within a few thousand records. Test the padded stride instead, which is what len accumulates. Assisted-by: Kiro Signed-off-by: huojianchao <[email protected]> --- drivers/note/noterpmsg_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/note/noterpmsg_driver.c b/drivers/note/noterpmsg_driver.c index 58f205e85d7..196558d7cb2 100644 --- a/drivers/note/noterpmsg_driver.c +++ b/drivers/note/noterpmsg_driver.c @@ -166,7 +166,7 @@ static bool noterpmsg_transfer(FAR struct noterpmsg_driver_s *drv, uint8_t notelen = drv->buffer[pos]; len = 0; - while (len + notelen <= space) + while (len + NOTE_ALIGN(notelen) <= space) { pos = noterpmsg_next(drv, pos, NOTE_ALIGN(notelen)); len += NOTE_ALIGN(notelen);
