Handling narrow return types on x86
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
CFFI |
New
|
Medium
|
Unassigned |
Bug Description
On Thu, Mar 26, 2009 at 9:03 PM, Jean-Claude Beaudoin
<email address hidden> wrote:
> Recent versions of GCC appear to be leaving spurious bits in the %eax
> register used to return the value of a C function on x86 based platforms
> when the return type is narrower than 32 bits (ie: short or char). SBCL
> does not defend itself against such register pollution and will return an
> incorrect value made up of those spurious bits in addition to the intended
> value. A partial fix for "signed" short and char has appeared in SBCL
> 1.0.25 but the "unsigned" cases are still vulnerable. I suggest that CFFI
> should defend itself against that dangerously permissive handling of narrow
> return types in SBCL through the use of a few filtering functions to be
> applied in those relevant cases, at least until SBCL fixes the issue for
> good.
Before any fix is commited, this bug should be reproduced/
(it deserves to be well explained somewhere in the source code) and a
test case written.
Further discussion: <http://