This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [RFC][PATCH]BZ#2337 Fix for spurious free of user buffer on fclose with wide char orientation.
- From: "Ryan S. Arnold" <rsa at us dot ibm dot com>
- To: Ulrich Drepper <drepper at redhat dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Fri, 06 Oct 2006 11:15:28 -0500
- Subject: Re: [RFC][PATCH]BZ#2337 Fix for spurious free of user buffer on fclose with wide char orientation.
- References: <1160148402.23227.27.camel@localhost.localdomain> <45267979.7090904@redhat.com>
On Fri, 2006-10-06 at 08:42 -0700, Ulrich Drepper wrote:
> Ryan S. Arnold wrote:
> > RFC regarding bugzilla 2337 -libio in wide mode deallocates user
> > supplied buffer:
>
> This issue is much more complicated. Wide streams and user-provided
> buffers are not correctly handled at all in the moment. The buffer
> should be used for the wide buffers, not the buffers for FILE back
> streams used to store the result of the conversion. I have been working
> on and off on this. It'll eventually get fixed, it's just not important
> enough to not be interrupted by other work.
>
Thanks for the comment Ulrich.
I noticed exactly what you described when I experimented with having
_IO_fwide() set the fp->_wide_data pointers to the non-wide user
supplied buffers fp->_IO_buf_base (et al) during orientation to
wide-char mode.
As you said, and my investigation indicated, the deep write functions
still make use of the non-wide buffers even in wide-char orientation.
I started working on a fix and could continue working on this if you'd
like? I suspect it'll require providing wide-character functions for
most of the _IO_wfile_jumps vtable entries that currently re-use the
non-wide character oriented functions.
Ryan S. Arnold
IBM Linux Technology Center