bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/6] parse-datetime, posixtm: avoid uninit access


From: Thien-Thi Nguyen
Subject: Re: [PATCH 1/6] parse-datetime, posixtm: avoid uninit access
Date: Tue, 26 Sep 2017 08:19:37 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

() Paul Eggert <address@hidden>
() Mon, 25 Sep 2017 18:29:08 -0700

   Do not access uninitialized storage, even though the
   resulting value is never used.

   [...]

   -      tm0 = tm;
   +      tm0.tm_sec = tm.tm_sec;
   +      tm0.tm_min = tm.tm_min;
   +      tm0.tm_hour = tm.tm_hour;
   +      tm0.tm_mday = tm.tm_mday;
   +      tm0.tm_mon = tm.tm_mon;
   +      tm0.tm_year = tm.tm_year;
   +      tm0.tm_isdst = tm.tm_isdst;

          Start = mktime_z (tz, &tm);

These changes look like a step backward in code readability,
which could prompt a naive programmer to propose their reversion
in the future (ping-pong problem).  Maybe add a preemptive
comment, or factor the assignments into a macro (w/ comment)?

-- 
Thien-Thi Nguyen -----------------------------------------------
 (defun responsep (query)
   (pcase (context query)
     (`(technical ,ml) (correctp ml))
     ...))                              748E A0E8 1CB8 A748 9BFA
--------------------------------------- 6CE4 6703 2224 4C80 7502

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]