std: fix Xous UDP recv length over-report and OOB panic#159523
Conversation
|
r? @Darksonn rustbot has assigned @Darksonn. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
|
Can you address the thing that rustbot mentioned? |
| for (&s, d) in rr[22..22 + max].iter().zip(buf.iter_mut()) { | ||
| *d = s; | ||
| } |
There was a problem hiding this comment.
Could we do this?
| for (&s, d) in rr[22..22 + max].iter().zip(buf.iter_mut()) { | |
| *d = s; | |
| } | |
| buf.copy_from_slice(&rr[22..22 + max]); |
And if so, then what about this?
| for (&s, d) in rr[22..22 + max].iter().zip(buf.iter_mut()) { | |
| *d = s; | |
| } | |
| buf.copy_from_slice(&rr[22..][..max]); |
There was a problem hiding this comment.
good point albeit I took a slightly different approach as both slices would need to be of the same length.
|
@rustbot author |
|
Reminder, once the PR becomes ready for a review, use |
recv_inner returned the datagram length instead of the bytes copied into the caller's buffer, and rxlen >= 4075 could index past the receive buffer and panic. Clamp the count to both buffers, mirroring the earlier send_to fix.
|
@rustbot ready |
|
Can we add a test for this? I'm not sure if we run tests for this target. |
Nope, it is tier 3, no CI job, and the target docs say the test suite isn't supported. The module is gated on |
std: fix Xous UDP recv length over-report and OOB panic recv_inner returned the datagram length instead of the bytes copied into the caller's buffer, and rxlen >= 4075 could index past the receive buffer and panic. Clamp the count to both buffers, as in rust-lang#158928.
std: fix Xous UDP recv length over-report and OOB panic recv_inner returned the datagram length instead of the bytes copied into the caller's buffer, and rxlen >= 4075 could index past the receive buffer and panic. Clamp the count to both buffers, as in rust-lang#158928.
std: fix Xous UDP recv length over-report and OOB panic recv_inner returned the datagram length instead of the bytes copied into the caller's buffer, and rxlen >= 4075 could index past the receive buffer and panic. Clamp the count to both buffers, as in rust-lang#158928.
Rollup of 8 pull requests Successful merges: - #159504 (Abort const-eval queries early when there are generics in the type) - #159523 (std: fix Xous UDP recv length over-report and OOB panic) - #159605 (Add fallback for `intrinsics::fabs`) - #159699 (bump std libc to 0.2.189) - #159306 (Add new variant to iterating-updating-mutref borrowck test) - #159346 (fs::hard_link: use linkat on Android) - #159513 (Consider `()` as suspicious only when expecting `!` for runtime symbols) - #159734 (Document the link_section attribute)
Rollup merge of #159523 - devnexen:xous_upd_fix_2, r=Darksonn std: fix Xous UDP recv length over-report and OOB panic recv_inner returned the datagram length instead of the bytes copied into the caller's buffer, and rxlen >= 4075 could index past the receive buffer and panic. Clamp the count to both buffers, as in #158928.
Rollup of 8 pull requests Successful merges: - rust-lang/rust#159504 (Abort const-eval queries early when there are generics in the type) - rust-lang/rust#159523 (std: fix Xous UDP recv length over-report and OOB panic) - rust-lang/rust#159605 (Add fallback for `intrinsics::fabs`) - rust-lang/rust#159699 (bump std libc to 0.2.189) - rust-lang/rust#159306 (Add new variant to iterating-updating-mutref borrowck test) - rust-lang/rust#159346 (fs::hard_link: use linkat on Android) - rust-lang/rust#159513 (Consider `()` as suspicious only when expecting `!` for runtime symbols) - rust-lang/rust#159734 (Document the link_section attribute)
recv_inner returned the datagram length instead of the bytes copied into the caller's buffer, and rxlen >= 4075 could index past the receive buffer and panic. Clamp the count to both buffers, as in #158928.