[tz] tzcode2021e: uninitialized variable in localtime.c

Christos Zoulas christos at zoulas.com
Wed Oct 27 11:52:24 UTC 2021



> On Oct 26, 2021, at 6:11 PM, Paul Eggert <eggert at cs.ucla.edu> wrote:
> 
> On 10/22/21 07:49, Christos Zoulas wrote:
> 
>> My linter reports "prevcorr" is uninitialized in the if statement
>> below the comment that starts "To avoid other botches".
> 
> Thanks for mentioning that. This prompted me to find an obscure bug in localtime that would cause it to access an uninitialized local variable (which is undefined behavior) in cases involving 32-bit time_t code reading malformed 64-bit data. I installed the attached patch to fix the bug, and I hope this also pacifies your linter.<0001-Fix-uninitialized-variable-bug.patch>

Thank you Paul! It does not fix my linter because it is not that smart, but now I can verify that the code is correct :-)
I avoid the warning, I just initialize "prevcorr" to 0.

Best,

christos


More information about the tz mailing list