Date: 09/27/00
- Next message: andy <email protected>: "[PHP-DEV] PHP 4.0 Bug #6909: tmp_upload_dir not working"
- Previous message: cqjones <email protected>: "[PHP-DEV] PHP 4.0 Bug #6907: configuration-parser.c won't compile"
- Next in thread: Bug Database: "[PHP-DEV] PHP 4.0 Bug #6913 Updated: wrong use of C language, serious bug!"
- Maybe reply: Bug Database: "[PHP-DEV] PHP 4.0 Bug #6913 Updated: wrong use of C language, serious bug!"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
ID: 6913
User Update by: melchers <email protected>
Status: Open
Bug Type: Sockets related
Description: wrong use of C language, serious bug!
i don't find this line in the php-3.x series,
although socket communication is not possible
in irix: fgets() never returns as long as
the other side keeps the socket open and
php is blocked by waiting for data.
The above error can trivially fixed by writing:
int ii;
if ((ii = FP_FGETC(socketd, (FILE*)what, issock)) == EOF) {
*buf = ii;
...
} else {
*buf = ii;
...
}
Previous Comments:
---------------------------------------------------------------------------
[2000-09-27 21:47:32] melchers <email protected>
file ext/standard/file.c contains the line:
if ((*buf = FP_FGETC(socketd, (FILE*)what, issock)) == EOF) {
this is a _serious_ bug, since on _all_ machine architectures where the data type
"char" defaults to unsigned, the return value of FP_FGETC() is converted to
unsigned, before it is compared to EOF. Since EOF is defined as (-1), the
comparison _never_ succedds. This makes any usage of sockets and file-I/O
on "unsigned char" architectures impossible. As far as i remember, the bug
occurs in all php versions, i.e. 3.x and 4.x.
my page for fgetc(3) says:
WARNING
If the integer value returned by getc, getchar, or fgetc is stored into a
character variable and then compared against the integer constant EOF,
the comparison may never succeed, because sign-extension of a character
on widening to integer is machine-dependent.
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=6913
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: andy <email protected>: "[PHP-DEV] PHP 4.0 Bug #6909: tmp_upload_dir not working"
- Previous message: cqjones <email protected>: "[PHP-DEV] PHP 4.0 Bug #6907: configuration-parser.c won't compile"
- Next in thread: Bug Database: "[PHP-DEV] PHP 4.0 Bug #6913 Updated: wrong use of C language, serious bug!"
- Maybe reply: Bug Database: "[PHP-DEV] PHP 4.0 Bug #6913 Updated: wrong use of C language, serious bug!"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

