fileno implicitly converted to pointer

Bug #402174 reported by LaMont Jones
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
fsl (Debian)
Fix Released
Unknown
fsl (Ubuntu)
Fix Released
High
Unassigned
Karmic
Fix Released
High
Unassigned

Bug Description

Binary package hint: fsl

Function `fileno' implicitly converted to pointer at wpng.c:279

Our automated build log filter[1] detected the problem(s) above that will
likely cause your package to segfault on 64-bit architectures (where the
size of a pointer is greater than the size of an integer.)

This is often due to a missing function prototype definition.
For more information, see [2].

Since use of implicitly converted pointers is always (eventually
and/or itermittantly) fatal to the application, they are errors.
Please correct them for your next upload.

[1] http://people.debian.org/~dannf/check-implicit-pointer-functions
[2] http://wiki.debian.org/ImplicitPointerConversions

Related branches

Steve Langasek (vorlon)
Changed in fsl (Ubuntu Karmic):
importance: Undecided → High
milestone: none → karmic-alpha-6
status: New → Triaged
Revision history for this message
Graziano (graziano-giuliani-gmail) wrote :

I was not able to reproduce any warning in compiling wpng.c using gcc 4.4.1-3ubuntu3 on karmic x86_64.

The fail line reported is:

[...]
279 if ((wpng_info.infile = fdopen(fileno(stdin), "rb")) == NULL) {
[...]

and personally I do not find errors in it.
The source file correctly includes stdio.h for prototypes:

typedef struct _IO_FILE FILE;
extern struct _IO_FILE *stdin;
FILE *fdopen(int fd, const char *mode);
int fileno(FILE *stream);

So we have an int coming from a call to fileno with the correct FILE structure pointer argument as input to the fdopen function which expects an integer. And gcc with -wall -pedantic does not report any error. Need to know which compiler version is used in the automatic test above.

Michael Terry (mterry)
Changed in fsl (Ubuntu Karmic):
assignee: nobody → Michael Terry (mterry)
status: Triaged → In Progress
Revision history for this message
Michael Terry (mterry) wrote :

The problem is that fsl is built with the -ansi flag. Thus, fdopen and fileno are not defined by default. In order to have them defined, either _GNU_SOURCE or _POSIX_SOURCE should be defined (exact list of symbols that would enable them are in their man pages).

Since many other files in the fsl source already define the pair of _GNU_SOURCE and POSIX_SOURCE for specific files, I just added them to the relevant wpng.c file (no patch system in the debian package, so I patched directly).

Will open a Debian bug too.

Changed in fsl (Ubuntu Karmic):
assignee: Michael Terry (mterry) → nobody
status: In Progress → Confirmed
Changed in fsl (Debian):
status: Unknown → New
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package fsl - 4.1.4-2ubuntu1

---------------
fsl (4.1.4-2ubuntu1) karmic; urgency=low

  * src/miscvis/wpng.c: Define _GNU_SOURCE to fix an ANSI C warning from
    the use of fdopen and fileno. LP: #402174

 -- Michael Terry <email address hidden> Thu, 10 Sep 2009 11:48:53 -0400

Changed in fsl (Ubuntu Karmic):
status: Confirmed → Fix Released
Changed in fsl (Debian):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.