From 5b509758a00995bcda2d1c5864f74a9f02fedbde Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 27 Jun 2002 13:01:35 +0000 Subject: [PATCH] * mmap.cc (list::match): Check using pagesize aligned size. --- winsup/cygwin/ChangeLog | 4 ++++ winsup/cygwin/mmap.cc | 10 ++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 18dd012aa..4d3acc72b 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,7 @@ +2002-06-27 Corinna Vinschen + + * mmap.cc (list::match): Check using pagesize aligned size. + 2002-06-26 Christopher Faylor * fhandler_disk_file.cc (fhandler_disk_file::fstat_by_name): Force diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc index c89cf4c7b..d1bda79d8 100644 --- a/winsup/cygwin/mmap.cc +++ b/winsup/cygwin/mmap.cc @@ -23,10 +23,10 @@ details. */ #include "pinfo.h" #include "sys/cygwin.h" -#define PAGE_CNT(bytes) howmany(bytes,getpagesize()) +#define PAGE_CNT(bytes) howmany((bytes),getpagesize()) #define PGBITS (sizeof(DWORD)*8) -#define MAPSIZE(pages) howmany(pages,PGBITS) +#define MAPSIZE(pages) howmany((pages),PGBITS) #define MAP_SET(n) (map_map_[(n)/PGBITS] |= (1L << ((n) % PGBITS))) #define MAP_CLR(n) (map_map_[(n)/PGBITS] &= ~(1L << ((n) % PGBITS))) @@ -315,7 +315,8 @@ list::match (__off64_t off, DWORD len) { for (int i = 0; i < nrecs; ++i) if (off >= recs[i].get_offset () - && off + len <= recs[i].get_offset () + recs[i].get_size ()) + && off + len <= recs[i].get_offset () + + (PAGE_CNT (recs[i].get_size ()) * getpagesize ())) return recs + i; } return NULL; @@ -327,7 +328,8 @@ list::match (caddr_t addr, DWORD len, __off32_t start) { for (int i = start + 1; i < nrecs; ++i) if (addr >= recs[i].get_address () - && addr + len <= recs[i].get_address () + recs[i].get_size ()) + && addr + len <= recs[i].get_address () + + (PAGE_CNT (recs[i].get_size ()) * getpagesize ())) return i; return -1; }