4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-02-22 00:38:06 +08:00

Cygwin: mmap_list::try_map: fix a condition in a test of an mmap request

In testing whether the requested area is contained in an existing
mapped region, an incorrect condition was used due to a
misinterpretation of the u_addr and u_len variables.

Addresses: https://cygwin.com/pipermail/cygwin/2024-December/256913.html
Fixes: c68de3a262fe5 ("* mmap.cc (class mmap_record):
Declare new map_pages method with address parameter.")
Signed-off-by: Ken Brown <kbrown@cornell.edu>
This commit is contained in:
Ken Brown 2024-12-18 11:43:09 -05:00
parent 677e315090
commit 67bef16f7e

View File

@ -651,7 +651,7 @@ mmap_list::try_map (void *addr, size_t len, int new_prot, int flags, off_t off)
break;
if (rec)
{
if (u_addr > (caddr_t) addr || u_addr + len < (caddr_t) addr + len
if (u_addr > (caddr_t) addr || u_addr + u_len < (caddr_t) addr + len
|| !rec->compatible_flags (flags))
{
/* Partial match only, or access mode doesn't match. */