[Privoxy-devel] more time questions
Lee
ler762 at gmail.com
Thu May 5 19:58:43 UTC 2016
On 5/5/16, Fabian Keil <fk at fabiankeil.de> wrote:
> Lee <ler762 at gmail.com> wrote:
>
>> On 5/3/16, Fabian Keil <fk at fabiankeil.de> wrote:
>> > Lee <ler762 at gmail.com> wrote:
[.. snip ..]
>>
>> Next set of questions is
>> - does timegm in miscutil.c leak memory on non-windows systems?
>>
>> old_zone = malloc(3 + strlen(zone) + 1);
>> ...
>> #ifdef _WIN32
>> free(old_zone);
>> #endif /* def _WIN32 */
>>
>> Seems like the code should be doing a free regardless of _WIN32 being
>> defined or not.
>
> POSIX-compliant putenv() implementations add the buffer directly to
> the environment in which case freeing it while it's in use results in
> memory corruption.
Really!? That's an .. interesting way to do it.
> Windows duplicates the buffer content but I'm not aware of other
> platforms that do this that also rely on the fallback timegm().
Implying the GLIBC implementation of timegm doesn't leak memory?
I downloaded the code for glibc-2.23 and tried to figure it out, but
that's going to take more time than I'm willing to spend right now.
(& I'm not asking you to figure it out for me. If you already know
the answer, please share. If not, someday when I'm sufficiently
motivated I'll figure it out for myself)
>> - is there a timing window in miscutil.c timegm that can change TZ to
>> "UTC"?
>>
>> Unless each thread get it's own copy of environment variables, it
>> seems like one thread can do
> [...]
>> and then the other thread does the putenv / tzset and TZ is
>> permanently changed to UTC.
>
> I agree that this could happen. The function can probably also
> temporarily affect timestamps used for log messages.
>
> You could try triggering the issues with Privoxy-Regression-Test's
> --fork option.
It took over an hour with --forks 100 and I didn't notice anything
weird with the date.
Thanks,
Lee
More information about the Privoxy-devel
mailing list