aboutgitcodebugslistschat
path: root/contrib/qemu/git:
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2025-03-17 20:24:15 +1100
committerStefano Brivio <sbrivio@redhat.com>2025-03-20 20:33:06 +0100
commite43e00719d7701301e4bc4fb179dc7adff175409 (patch)
treea9a905785d1dacbca34f751fe30d7b4028c30e1d /contrib/qemu/git:
parent4592719a744bcb47db2ff5680be4b8f6362a97ce (diff)
downloadpasst-e43e00719d7701301e4bc4fb179dc7adff175409.tar
passt-e43e00719d7701301e4bc4fb179dc7adff175409.tar.gz
passt-e43e00719d7701301e4bc4fb179dc7adff175409.tar.bz2
passt-e43e00719d7701301e4bc4fb179dc7adff175409.tar.lz
passt-e43e00719d7701301e4bc4fb179dc7adff175409.tar.xz
passt-e43e00719d7701301e4bc4fb179dc7adff175409.tar.zst
passt-e43e00719d7701301e4bc4fb179dc7adff175409.zip
packet: More cautious checks to avoid pointer arithmetic UB
packet_check_range and vu_packet_check_range() verify that the packet or section of packet we're interested in lies in the packet buffer pool we expect it to. However, in doing so it doesn't avoid the possibility of an integer overflow while performing pointer arithmetic, with is UB. In fact, AFAICT it's UB even to use arbitrary pointer arithmetic to construct a pointer outside of a known valid buffer. To do this safely, we can't calculate the end of a memory region with pointer addition when then the length as untrusted. Instead we must work out the offset of one memory region within another using pointer subtraction, then do integer checks against the length of the outer region. We then need to be careful about the order of checks so that those integer checks can't themselves overflow. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'contrib/qemu/git:')
0 files changed, 0 insertions, 0 deletions