On 2024-12-16 05:05, Bruno Haible wrote:

Today, coverity reports that in lib/time_rz.c line 303
"Field tm_1.tm_gmtoff is uninitialized."

Is it really uninitialized after the mktime() call in line 298?

Only if that mktime call failed, which is impossible if the call made tm_yday nonnegative. Evidently this subtlety escaped Coverity. My guess is that Coverity mistakenly thinks that mktime fails if and only if it returns (time_t) -1, something that the code doesn't (and needn't) check for.


Is it a problem if it is uninitialized?

It would be, yes, because it would mean an otherwise-successful mktime_z would deliver garbage tm_gmtoff to its caller.

It is puzzling that Coverity complained only about tm_gmtoff, and not about other tm_1 members. However, the bottom line is that this is a false alarm and we needn't worry about it.

Reply via email to