﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	difficulty
1005	pointer data structures don't overflow reliably, also this does not catch mmap error situations	Christian Kellermann		"I have just came across this issue when dealing with a failed mmap FFI call. In this case mmap (The C function) will return a MAP_FAILED which is defined as (void*)-1 on linux and OpenBSD.

The mmap code checks for this by doing a (eq? -1 addr2). This is fine for 32 bit systems but not for 64 bit systems.

{{{
;; on 32 bit
#;2> (address->pointer -1)
#<pointer 0xffffffff>

;; on 64 bit
#;2> (address->pointer -1)
#<pointer 0x0>
#;3> (pointer->address #2)
1.84467440737096e+19
}}}

Note how the pointer printing code also gets it wrong.

A current workaround would be to explicitly check for the -1 pointer representation:

{{{
(pointer=? (address->pointer -1) addr2)
}}}

This works but looks icky. I am not sure how to handle this right."	defect	new	major	someday	unknown	4.8.x		mmap ffi pointer suckage		
