View Issue Details

IDProjectCategoryView StatusLast Update
0001628GNUnetutil librarypublic2011-09-19 10:45
ReporterLRN Assigned ToNDurner  
PriorityhighSeveritymajorReproducibilityN/A
Status closedResolutionfixed 
Summary0001628: Bad memory unmapping on W32
DescriptionUnmapViewOfFile() takes base address (as returned by MapViewOfFile()), not HANDLE.
Patch attached.
With this simple patch and with 0001616 fixed i was able to pass statistics test on W32
TagsNo tags attached.
Attached Files
0001-W32-unmap-fix.patch (1,281 bytes)   
From 4e568d23396bcdec86fc0191cf6e8380feddd192 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1=D1=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Mon, 6 Dec 2010 03:49:25 +0300
Subject: [PATCH] W32 unmap fix

---
 src/util/disk.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/util/disk.c b/src/util/disk.c
index 5d35fa0..b8bc946 100644
--- a/src/util/disk.c
+++ b/src/util/disk.c
@@ -1484,6 +1484,10 @@ struct GNUNET_DISK_MapHandle
    * Underlying OS handle.
    */
   HANDLE h;
+  /**
+   * Base address of the mapped memory.
+   */
+  void *base;
 #else
   /**
    * Address where the map is in memory.
@@ -1564,7 +1568,7 @@ GNUNET_DISK_file_map (const struct GNUNET_DISK_FileHandle *h,
       CloseHandle ((*m)->h);
       GNUNET_free (*m);
     }
-
+  (*m)->base = ret;
   return ret;
 #else
   int prot;
@@ -1603,7 +1607,7 @@ GNUNET_DISK_file_unmap (struct GNUNET_DISK_MapHandle *h)
     }
 
 #ifdef MINGW
-  ret = UnmapViewOfFile (h->h) ? GNUNET_OK : GNUNET_SYSERR;
+  ret = UnmapViewOfFile (h->base) ? GNUNET_OK : GNUNET_SYSERR;
   if (ret != GNUNET_OK)
     SetErrnoFromWinError (GetLastError ());
   if (!CloseHandle (h->h) && (ret == GNUNET_OK))
-- 
1.7.3.1.msysgit.0

0001-W32-unmap-fix.patch (1,281 bytes)   

Activities

NDurner

2010-12-13 22:05

reporter   ~0004205

fixed in r13899, thanks

Issue History

Date Modified Username Field Change
2010-12-06 01:51 LRN New Issue
2010-12-06 01:51 LRN File Added: 0001-W32-unmap-fix.patch
2010-12-07 23:52 NDurner Status new => assigned
2010-12-07 23:52 NDurner Assigned To => NDurner
2010-12-09 11:44 NDurner Status assigned => acknowledged
2010-12-13 11:43 NDurner Status acknowledged => confirmed
2010-12-13 22:05 NDurner Note Added: 0004205
2010-12-13 22:05 NDurner Status confirmed => resolved
2010-12-13 22:05 NDurner Fixed in Version => Git master
2010-12-13 22:05 NDurner Resolution open => fixed
2010-12-23 23:50 Christian Grothoff Status resolved => closed
2011-09-19 10:45 Christian Grothoff Fixed in Version Git master => 0.9.0pre3
2011-09-19 10:45 Christian Grothoff Target Version Git master => 0.9.0pre3