This is the mail archive of the
mailing list for the glibc project.
[Bug libc/2337] libio in wide mode deallocates user supplied buffer
- From: "rsa at us dot ibm dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 6 Oct 2006 06:00:26 -0000
- Subject: [Bug libc/2337] libio in wide mode deallocates user supplied buffer
- References: <20060214170527.2337.Petr.Salinger@seznam.cz>
- Reply-to: sourceware-bugzilla at sourceware dot org
------- Additional Comments From rsa at us dot ibm dot com 2006-10-06 06:00 -------
Created an attachment (id=1351)
libio patch to prevent spurious deallocation of user supplied buffer.
Directing wide-character IO to use the user supplied buffer proved to be
problematic because the wide character operations make use of the non-wide
character buffer for write operations.
The least intrusive solution was to clean up the IO file finish path. The wide
character jump vtable is initialized such that wide-character IO uses the
default (non-wide) _IO_file_finish() function (probably an oversight) which
invokes _IO_default_finish(). This ends up checking and clearing the non-wide
user buffer spuriously in _IO_new_fclose().
I created a wide-character oriented file finish function _IO_wfile_finish()
which calls the already existing _IO_wdefault_finish() function and I added it
to the wide IO jump table as the default IO file finish function.
This solved the problem and wide character IO now finishes in a manner
consistent with the IO orientation.
I've only tested this on PowerPC thus far.
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.