diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2018-04-22 00:51:17 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2018-04-22 00:51:17 +0200 |
commit | 926090c399ab503d6f7f67a9556d46b5094fd20f (patch) | |
tree | cf602790f14739acf2fde5defd4acf18fcf10c41 | |
parent | d593f4c0721695688042eb5295c52c06ded07942 (diff) | |
download | gnumach-926090c399ab503d6f7f67a9556d46b5094fd20f.tar.gz gnumach-926090c399ab503d6f7f67a9556d46b5094fd20f.tar.bz2 gnumach-926090c399ab503d6f7f67a9556d46b5094fd20f.zip |
vm_map: Fix bugs on huge masks parameters
* vm/vm_map.c (vm_map_find_entry_anywhere): Also check that (min + mask) &
~mask remains bigger than min.
-rw-r--r-- | version.m4 | 2 | ||||
-rw-r--r-- | vm/vm_map.c | 6 |
2 files changed, 5 insertions, 3 deletions
@@ -1,4 +1,4 @@ m4_define([AC_PACKAGE_NAME],[GNU Mach]) -m4_define([AC_PACKAGE_VERSION],[1.8]) +m4_define([AC_PACKAGE_VERSION],[1.8+git20180218]) m4_define([AC_PACKAGE_BUGREPORT],[bug-hurd@gnu.org]) m4_define([AC_PACKAGE_TARNAME],[gnumach]) diff --git a/vm/vm_map.c b/vm/vm_map.c index 4da72d4e..2fd27316 100644 --- a/vm/vm_map.c +++ b/vm/vm_map.c @@ -685,7 +685,7 @@ restart: start = (map->min_offset + mask) & ~mask; end = start + size; - if ((end <= start) || (end > map->max_offset)) { + if ((start < map->min_offset) || (end <= start) || (end > map->max_offset)) { goto error; } @@ -699,7 +699,8 @@ restart: start = (entry->vme_end + mask) & ~mask; end = start + size; - if ((end > start) + if ((start >= entry->vme_end) + && (end > start) && (end <= map->max_offset) && (end <= (entry->vme_end + entry->gap_size))) { *startp = start; @@ -738,6 +739,7 @@ restart: assert(entry->gap_size >= max_size); start = (entry->vme_end + mask) & ~mask; + assert(start >= entry->vme_end); end = start + size; assert(end > start); assert(end <= (entry->vme_end + entry->gap_size)); |