This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


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

Re: [PATCH v4] libio: do not attempt to free wide buffers of legacy streams [BZ #24228]


* Dmitry V. Levin:

> Commit a601b74d31ca086de38441d316a3dee24c866305 aka glibc-2.23~693
> ("In preparation for fixing BZ#16734, fix failure in misc/tst-error1-mem
> when _G_HAVE_MMAP is turned off.") introduced a regression:
> _IO_unbuffer_all() now invokes _IO_wsetb() to free wide buffers of all
> files, including legacy standard files which are small statically
> allocated objects that do not have wide buffers and the _mode member,
> causing memory corruption.
>
> Another memory corruption in _IO_unbuffer_all() happens when -1
> is assigned to the _mode member of legacy standard files that do not
> have it.

GNU style calls for not putting () after function names.  (Sorry, I must
sound like a broken record).

> diff --git a/libio/Makefile b/libio/Makefile
> index 7d53cb06b0..b81e8bf5e2 100644
> --- a/libio/Makefile
> +++ b/libio/Makefile
> @@ -65,7 +65,7 @@ tests = tst_swprintf tst_wprintf tst_swscanf tst_wscanf tst_getwc tst_putwc   \
>  	tst-setvbuf1 tst-popen1 tst-fgetwc bug-wsetpos tst-fseek \
>  	tst-fwrite-error tst-ftell-partial-wide tst-ftell-active-handler \
>  	tst-ftell-append tst-fputws tst-bz22415 tst-fgetc-after-eof \
> -	tst-sprintf-ub tst-sprintf-chk-ub tst-bz24051 tst-bz24153 \
> +	tst-sprintf-ub tst-sprintf-chk-ub tst-bz24051 tst-bz24153 tst-bz24228 \
>  	tst-wfile-sync tst-wfile-gconv

I suggest to qualify the new test with “ifeq ($(build-shared),yes)”.  It
can never meet its test objective with static linking because the
relevant code just is not there.

Rest looks good to me, thanks.

I can confirm that it fixes the OpenJDK failure we saw.

Thanks,
Florian


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