On 6/24/19 11:01 AM, Frederic Lecaille wrote:
Hi Tim,
On 6/23/19 10:10 PM, Tim Duesterhus wrote:
Consider a config like:
global
log 127.0.0.1:10001 sample :10 local0
No sampling ranges are given here, leading to NULL being passed
as the first argument to qsort.
This configuration does not make sense anyway, a log without ranges
would never log. Thus output an error if no ranges are given.
Calling qsort() with such a <base> value is not a bug as far as the
second argument (the size of the array with <base> as address) is 0.
See 7.20.5 http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf
Well after having read this paragraph carefully:
"Pointer arguments on such a call shall still have valid values, as
described in 7.1.4."
So, my understanding of this paragraph is that even if the size of the
array is 0, the pointer to the array must be valid. If not, it is UB.
Fred.