sort: simpler fix for sort -u data-loss bug, and for a FMR bug
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 17 Aug 2012 20:26:00 +0000 (13:26 -0700)
committerJim Meyering <meyering@redhat.com>
Sat, 18 Aug 2012 05:39:29 +0000 (07:39 +0200)
commit574b7c7dbec8821d03a462796968847783d07c29
tree25d956ae0f12851bfa2111dd533a705804a1f5c7
parenteb3f5b3b3de8c6ca005a701f09bff43d778aece7
sort: simpler fix for sort -u data-loss bug, and for a FMR bug

This also fixes a free-memory-read (FMR) bug: when fillbuf's realloc
of buf->buf frees the buffer into which saved_line.text points,
the processing of that just-read longer line includes comparison
against the saved line in freed memory.
* src/sort.c (overlap): Remove.
(fillbuf): Do not try to copy saved lines, as that is too risky
in the presence of parallelism, reallocated buffers, etc.
(sort): Invalidate any saved line before sorting a new batch.
src/sort.c