GNU bug report logs -
#69709
`sort` interface improvement and universal ordering predicate
Previous Next
Full log
View this message in rfc822 format
14 apr. 2024 kl. 18.26 skrev Eli Zaretskii <eliz <at> gnu.org>:
>> Thank you for your excellent work on `sort` and related functionality!
Apparently not excellent enough!
>> Unfortunately, the new `sort` implementation occasionally crashes with a
>> segfault. The following code reproduces that in current master:
>>
>> (dotimes (i 500)
>> (sort (make-list 128 42)
>> :key (lambda (n) (make-list i n))))
>>
>> It happens for inputs of length >= `MERGESTATE_TEMP_SIZE / 2` (= 128
>> currently) along with a non-NIL `:key` function. In such cases, a
>> `Lisp_Object` array is explicitly heap-allocated to store the keys, which is
>> never marked against GC. This would not be a problem if not for the fact that
>> the `:key` function call may trigger GC.
Oh dear, what a silly mistake. Many thanks for spotting this and providing the patch, which I applied with a few minor adjustments (and a regression test).
This bug report was last modified 1 year and 89 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.