The following issue has been UPDATED.
======================================================================
http://austingroupbugs.net/view.php?id=74
======================================================================
Reported By: nick
Assigned To: ajosey
======================================================================
Project: 1003.1(2008)/Issue 7
Issue ID: 74
Category: System Interfaces
Type: Error
Severity: Objection
Priority: normal
Status: Resolved
Name: Nick Stoughton
Organization:
User Reference: Pointer
Section: (section number or name, can be interface name)
Page Number: 541
Line Number: 18886
Final Accepted Text: http://austingroupbugs.net/view.php?id=74#c129
Resolution: Accepted As Marked
Fixed in Version:
======================================================================
Date Submitted: 2009-06-29 02:27 UTC
Last Modified: 2009-07-01 14:02 UTC
======================================================================
Summary: Pointer Types Problem
Description:
_____________________________________________________________________________
OBJECTION Enhancement Request
Number 11
nick:xxxxxxxxxx Bug in XSHd5.1 Pointer Types (rdvk#
1)
{NMS-funcptr} Wed, 10 Sep 2008 21:05:32 +0100
(BST)
_____________________________________________________________________________
In order to support the dynamic library functions (and dlsym() in
particular), POSIX extends the C standard to require that a
pointer to a function can be stored in a pointer to void.
This explicit extension opens the door to permit conversion (via other
promises in the C standard) of a pointer to a data object
into a pointer to a function, thus requiring code such as below
to work:
char buf[1024];
void *p;
int (*f)(void);
// assemble instructions into buf
p = buf;
f = p;
f();
In practice, many implementations will forbid execution of data
in this form, as it is frequently a source of security vulnerabilities.
Similarly, it need not necessarily be supported to try to examine
the instructions that make a function by casting (or converting via
a void *) a pointer-to-function into a pointer-to-object.
The intent is simply to permit dlsym to use a void * as its return type.
Desired Action:
After the sentence ending on line 18890, add the following:
If a pointer to an object or incomplete type is converted to a pointer
to void and then to a pointer to a function type, or vice-versa,
the behaviour is undefined.
======================================================================
----------------------------------------------------------------------
(0000129) msbrown (manager) - 2009-06-29 02:27
http://austingroupbugs.net/view.php?id=74#c129
----------------------------------------------------------------------
After the sentence ending on line 18890, add the following:
If a pointer to an object or incomplete type is converted to a pointer
to void and then to a pointer to a function type the behavior
is undefined., If a pointer to a function type is converted to
a pointer to void and then to a pointer to an object or an incomplete
type the behaviour is undefined.
|