This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix mmap stdio bug


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]