[PATCH] Fix mmap stdio bug

Jakub Jelinek jakub@redhat.com
Mon Feb 18 16:43:00 GMT 2002


Hi!

I think the patch is self-explaining and I'm not sure how useful is to
include a testcase for this into the testsuite (on ia64 ld could not link
crti.o because it was trying to fseek to a location in the file which
contained '\xff').

2002-02-19  Jakub Jelinek  <jakub@redhat.com>

	* libio/fileops.c (_IO_file_underflow_mmap): Cast to unsigned char
	pointer before dereferencing.

--- libc/libio/fileops.c.jj	Wed Jan 30 18:01:24 2002
+++ libc/libio/fileops.c	Tue Feb 19 01:42:56 2002
@@ -579,7 +579,7 @@ _IO_file_underflow_mmap (_IO_FILE *fp)
 
       fp->_offset = fp->_IO_buf_end - fp->_IO_buf_base;
       fp->_IO_read_end = fp->_IO_buf_end;
-      return *fp->_IO_read_ptr;
+      return *(unsigned char *) fp->_IO_read_ptr;
     }
 
   fp->_flags |= _IO_EOF_SEEN;

	Jakub



More information about the Libc-hacker mailing list