From e959f54351a5fa9e7c740be73490eafdf01af0bf Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Thu, 29 Feb 2024 17:26:07 +0200 Subject: [PATCH] lib/fs: properly handle the case when data=nil is passed to mUnmap --- lib/fs/fs_windows.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/fs/fs_windows.go b/lib/fs/fs_windows.go index c28e1bce7..83b5483a1 100644 --- a/lib/fs/fs_windows.go +++ b/lib/fs/fs_windows.go @@ -101,7 +101,7 @@ func mmap(fd int, length int) ([]byte, error) { func mUnmap(data []byte) error { // flush is not needed, since we perform only reading operation. // In case of write, additional call FlushViewOfFile must be performed. - addr := uintptr(unsafe.Pointer(&data[0])) + addr := uintptr(unsafe.Pointer(unsafe.SliceData(data))) mmapByAddrLock.Lock() h, ok := mmapByAddr[addr]