From 67bef16f7edf8642366ff55399bf9cf007c66d52 Mon Sep 17 00:00:00 2001 From: Ken Brown Date: Wed, 18 Dec 2024 11:43:09 -0500 Subject: 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 --- winsup/cygwin/mm/mmap.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winsup/cygwin/mm/mmap.cc b/winsup/cygwin/mm/mmap.cc index 4fec64b..13418d7 100644 --- a/winsup/cygwin/mm/mmap.cc +++ b/winsup/cygwin/mm/mmap.cc @@ -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. */ -- cgit v1.1