[CentOS-devel] [PATCH] Fix memory leak in i18n support for sort utility

Yousong Zhou

yszhou4tech at gmail.com
Tue Jan 30 12:24:34 UTC 2018

On 30 January 2018 at 15:58, Kamil Dudka <kdudka at redhat.com> wrote:
> On Tuesday, January 30, 2018 3:01:54 AM CET Yousong Zhou wrote:
>> On 30 January 2018 at 02:58, Kamil Dudka <kdudka at redhat.com> wrote:
>> > On Wednesday, January 24, 2018 1:18:35 PM CET Yousong Zhou wrote:
>> >> This can be triggered by using month sort
>> >>
>> >> The issue with the original code is that after the call to mbsrtowcs()
>> >> and wcsrtombs() returns, the source pointer will be set to NULL causing
>> >> the later free() call has no effect at all
>> >> ---
>> >> The issue also exists in c6 branch
>> >
>> > Thank you for sharing the patch!  This was tracked as Fedora bug #1259942:
>> >
>> > https://bugzilla.redhat.com/1259942
>> >
>> > The bug was fixed in coreutils-8.23-11.fc22 and it is going to be fixed
>> > in the next major version of RHEL (and CentOS).
>> >
>> > Kamil
>> Hi Kamil.  I thought there must exist some kind of mechanism for
>> backporting bugfixes of this kind into currently maintained versions.
>> It should!  It's an old bug already known and fixed in 2015 and still
>> people are wasting time and getting frustrated by it in 2018!
>>                 yousong
> Sorry to hear that.  We do not backport non-critical fixes from Fedora to RHEL
> proactively.  Updates in RHEL are primarily driven by requests of Red Hat's
> customers.
> I have cloned the bug for RHEL-7 to get this fixed eventually:
> https://bugzilla.redhat.com/1540059
> Unfortunately, I cannot guarantee any schedule for merging the fix.  If you
> are a customer of Red Hat, please contact the product support and tell them
> about this bug.
> Kamil

Thanks for doing this.

I encountered this bug when I was using sort to --merge multiple log
files with month fields of the form Jan, Feb etc.  It caused the
kernel to oom which was unexpected since the very merge sort should
run in linear time complexity with fixed amount of memory.


More information about the CentOS-devel mailing list