On 05/12/2014 10:47 AM, Steve Hill wrote:
> Squid 3.4.5 segfaults when formatting log lines for me. It looks like
> this is down to fmt->data.timespec being uninitialised, and affects the
> %tg format specifier.
>
> As far as I can tell, fmt->data.timespec is never set anywhere, and we
> should probably be using fmt->data.string instead.
>
> The attached patch removes timespec, fixing the segmentation fault.
>
> I can't see any relevant code change between 3.4.4 and 3.4.5, so I'm
> guessing this may be down to the toolchain change. Presumably the
> compiler used to initialise the pointer to NULL and nolonger does.
The Token class in v3.4 uses an ugly union (instead of "struct") for the
data member. Thus, data.timespec should be identical to data.string. The
fact that changing .timespec to .string makes a difference indicates
that something else is probably broken.
While working on trunk r13387, Christos found several union-related
problems/mysteries, and I suspect you are being bitten by one of them.
That would "explain" why the segfault suddenly appeared in the seemingly
unchanged code. FWIW, Christos' trunk r13387 removes that ugly data
union, but does not initialize timespec (despite claiming to do so; a bug).
Since using .string works for you, I suggest accepting your patch for
both v3.4 and trunk. The patch effects will be somewhat different in
each branch, but are probably desirable in both cases.
Thank you,
Alex.
Received on Mon May 12 2014 - 17:20:26 MDT
This archive was generated by hypermail 2.2.0 : Tue May 13 2014 - 12:00:13 MDT