<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en" style='--code-editor-font: var(--default-mono-font, "GitLab Mono"), JetBrains Mono, Menlo, DejaVu Sans Mono, Liberation Mono, Consolas, Ubuntu Mono, Courier New, andale mono, lucida console, monospace;'>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>
GitLab
</title>
<style data-premailer="ignore" type="text/css">
a { color: #1068bf; }
</style>
<style>img {
max-width: 100%; height: auto;
}
body {
font-size: .875rem;
}
body {
-webkit-text-shadow: hsla(0,0%,100%,.01) 0 0 1px;
}
body {
font-family: "GitLab Sans",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Noto Sans",Ubuntu,Cantarell,"Helvetica Neue",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"; font-size: inherit;
}
</style>
</head>
<body style='font-size: inherit; -webkit-text-shadow: hsla(0,0%,100%,.01) 0 0 1px; font-family: "GitLab Sans",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Noto Sans",Ubuntu,Cantarell,"Helvetica Neue",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";'>
<div class="content">
<h3 style="margin-top: 20px; margin-bottom: 10px;">
Matt Selsky pushed to branch master at <a href="https://gitlab.com/NTPsec/ntpsec">NTPsec / ntpsec</a>
</h3>
<h4 style="margin-top: 10px; margin-bottom: 10px;">
Commits:
</h4>
<ul>
<li>
<strong style="font-weight: 600;"><a href="https://gitlab.com/NTPsec/ntpsec/-/commit/b6c8155e1c862bdfe79c381b8a96cdc6859c6f57">b6c8155e</a></strong>
<div>
<span> by Matt Selsky </span> <i> at 2026-10-02T02:39:35-04:00 </i>
</div>
<pre class="commit-message" style='white-space: pre-wrap; display: block; font-size: 14px; color: #3a383d; position: relative; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: break-all; word-wrap: break-word; background-color: #f7f7f5; border-radius: 2px; margin: 0; padding: 8px 12px; border: 1px solid #dcdbd9;'>libparse/clk_trimtsip.c: fix copy-paste bug in TSIP week unwrap
t_week (current GPS week) and t_weekleap (week of the next scheduled
leap-second correction) are distinct fields. When t_week needed epoch
unwrap, the code set it from t_weekleap+GPSWEEKS instead of
t_week+GPSWEEKS - introduced in d21c57eec (2015-03-19), a mechanical
type-cast cleanup that got the adjacent near-identical
t_weekleap/t_week blocks crossed. Coverity correctly flagged this as
a copy-paste error in b1fa16c58 (2015-11-04), but the finding was
suppressed rather than investigated ("More Coverity cleanup. No logic
changes.").
Impact - t_week's only consumer in this file is the leap-imminent
check (t_weekleap - t_week) < 5, which decides whether to raise the
driver's leap-second warning (ADDSECOND/DELSECOND):
- The bug does not affect the time value this refclock reports -
only that advisory flag.
- Since t_weekleap is already unwrapped by this point, the buggy line
sets t_week = t_weekleap + GPSWEEKS, so t_weekleap - t_week is
exactly -1024 (not close to zero) - and -1024 < 5 unconditionally,
every time. A server using the Trimble TSIP refclock would tell
every client polling it, via the standard NTP leap-indicator bits,
that a leap second is imminent as soon as the receiver has any leap
correction queued at all - weeks or months before the intended
~5-week window, deterministically, not just occasionally missing
the window.
- GPSWRAP is 990 of a 1024-week range, so the buggy branch executes
on ~97% of CMD_RUTCPARAM messages, but the effect is only visible
when the receiver also has a genuinely pending leap-second change
(tlsf != tls) - an infrequent real-world event (most recently Dec
2016). A given deployment could run for years without observing
this, despite the code path itself being live almost always.
- Local hardware refclock parsing, not network-facing - a
false-early leap-indicator bug, not a security issue.
Restore the original t_week += GPSWEEKS form (the pre-2015 code, and
what the fixed logic actually needs) rather than the explicit-cast
reassignment - the cast was never required (unsigned short += int is
well-defined, and the max resulting value here is 2013) and the
project doesn't build with -Wconversion, so it was solely a leftover
of that unrelated 2015 cleanup pass. Drop the now-stale coverity[]
suppression comment along with it.
</pre>
</li>
</ul>
<h4 style="margin-top: 10px; margin-bottom: 10px;">
1 changed file:
</h4>
<ul>
<li class="file-stats">
<a href="#f2d4d31e3ea3bfbe56685c9cf61779ac6123ac5f">
libparse/clk_trimtsip.c
</a>
</li>
</ul>
<h4 style="margin-top: 10px; margin-bottom: 10px;">
Changes:
</h4>
<li id="f2d4d31e3ea3bfbe56685c9cf61779ac6123ac5f">
<a href="https://gitlab.com/NTPsec/ntpsec/-/commit/b6c8155e1c862bdfe79c381b8a96cdc6859c6f57#f2d4d31e3ea3bfbe56685c9cf61779ac6123ac5f"><strong style="font-weight: 600;">libparse/clk_trimtsip.c</strong></a>
<hr style="overflow: hidden; border: 1px solid #dcdbd9;">
<table class="code white" style="border-spacing: 0; border-collapse: collapse; width: auto; font-family: monospace; font-size: 90%;" bgcolor="#ffffff" width="100%" cellpadding="0" cellspacing="0">
<tr class="line_holder match" style="line-height: 1.6;">
<td class="diff-line-num unfold js-unfold old_line" data-linenumber="324" style="width: 35px; color: rgba(5,5,6,.24); border-right-width: 1px; border-right-color: #ecebea; border-right-style: solid; padding: inherit;" align="right" bgcolor="#f7f7f5">...</td>
<td class="diff-line-num unfold js-unfold new_line" data-linenumber="324" style="width: 35px; color: rgba(5,5,6,.24); border-right-width: 1px; border-right-color: #ecebea; border-right-style: solid; padding: inherit;" align="right" bgcolor="#f7f7f5">...</td>
<td class="line_content match" style="color: rgba(5,5,6,.24); padding: inherit;" bgcolor="#f7f7f5">@@ -324,8 +324,7 @@ cvt_trimtsip(</td>
</tr>
<tr class="line_holder" style="line-height: 1.6;">
<td class="old_line diff-line-num" data-linenumber="324" style="width: 35px; color: rgba(5,5,6,.24); border-right-width: 1px; border-right-color: #ecebea; border-right-style: solid; padding: inherit;" align="right" bgcolor="#f7f7f5">
324
</td>
<td class="new_line diff-line-num" data-linenumber="324" style="width: 35px; color: rgba(5,5,6,.24); border-right-width: 1px; border-right-color: #ecebea; border-right-style: solid; padding: inherit;" align="right" bgcolor="#f7f7f5">
324
</td>
<td class="line_content" style="padding: inherit;"><pre style='display: block; font-size: 14px; color: #3a383d; position: relative; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: break-all; word-wrap: break-word; background-color: inherit; border-radius: 2px; margin: 0; padding: 0; border: inherit solid #dcdbd9;'> <span class="line" data-lang="c"> <span class="cm" style="color: #999988; font-style: italic;">/* current week no */</span></span>
</pre></td>
</tr>
<tr class="line_holder" style="line-height: 1.6;">
<td class="old_line diff-line-num" data-linenumber="325" style="width: 35px; color: rgba(5,5,6,.24); border-right-width: 1px; border-right-color: #ecebea; border-right-style: solid; padding: inherit;" align="right" bgcolor="#f7f7f5">
325
</td>
<td class="new_line diff-line-num" data-linenumber="325" style="width: 35px; color: rgba(5,5,6,.24); border-right-width: 1px; border-right-color: #ecebea; border-right-style: solid; padding: inherit;" align="right" bgcolor="#f7f7f5">
325
</td>
<td class="line_content" style="padding: inherit;"><pre style='display: block; font-size: 14px; color: #3a383d; position: relative; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: break-all; word-wrap: break-word; background-color: inherit; border-radius: 2px; margin: 0; padding: 0; border: inherit solid #dcdbd9;'> <span class="line" data-lang="c"> <span class="n" style="color: #333333;">t</span><span class="o" style="font-weight: 600;">-></span><span class="n" style="color: #333333;">t_week</span> <span class="o" style="font-weight: 600;">=</span> <span class="n" style="color: #333333;">get_msb_ushort</span><span class="p">(</span><span class="o" style="font-weight: 600;">&</span><span class="n" style="color: #333333;">mb</span><span class="p">(</span><span class="mi" style="color: #009999;">18</span><span class="p">));</span></span>
</pre></td>
</tr>
<tr class="line_holder" style="line-height: 1.6;">
<td class="old_line diff-line-num" data-linenumber="326" style="width: 35px; color: rgba(5,5,6,.24); border-right-width: 1px; border-right-color: #ecebea; border-right-style: solid; padding: inherit;" align="right" bgcolor="#f7f7f5">
326
</td>
<td class="new_line diff-line-num" data-linenumber="326" style="width: 35px; color: rgba(5,5,6,.24); border-right-width: 1px; border-right-color: #ecebea; border-right-style: solid; padding: inherit;" align="right" bgcolor="#f7f7f5">
326
</td>
<td class="line_content" style="padding: inherit;"><pre style='display: block; font-size: 14px; color: #3a383d; position: relative; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: break-all; word-wrap: break-word; background-color: inherit; border-radius: 2px; margin: 0; padding: 0; border: inherit solid #dcdbd9;'> <span class="line" data-lang="c"> <span class="k" style="font-weight: 600;">if</span> <span class="p">(</span><span class="n" style="color: #333333;">t</span><span class="o" style="font-weight: 600;">-></span><span class="n" style="color: #333333;">t_week</span> <span class="o" style="font-weight: 600;"><</span> <span class="n" style="color: #333333;">GPSWRAP</span><span class="p">)</span> <span class="p">{</span></span>
</pre></td>
</tr>
<tr class="line_holder old" style="line-height: 1.6;">
<td class="old_line diff-line-num old" data-linenumber="327" style="width: 35px; color: rgba(5,5,6,.24); border-right-width: 1px; border-right-color: #fac5cd; border-right-style: solid; padding: inherit;" align="right" bgcolor="#f9d7dc">
327
</td>
<td class="new_line diff-line-num old" data-linenumber="327" style="width: 35px; color: rgba(5,5,6,.24); border-right-width: 1px; border-right-color: #fac5cd; border-right-style: solid; padding: inherit;" align="right" bgcolor="#f9d7dc">
</td>
<td class="line_content old" style="padding: inherit;" bgcolor="#fbe9eb"><pre style='display: block; font-size: 14px; color: #3a383d; position: relative; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: break-all; word-wrap: break-word; background-color: inherit; border-radius: 2px; margin: 0; padding: 0; border: inherit solid #dcdbd9;'>-<span class="line" data-lang="c"> <span class="cm" style="color: #999988; font-style: italic;">/* coverity[copy_paste_error] */</span></span>
</pre></td>
</tr>
<tr class="line_holder old" style="line-height: 1.6;">
<td class="old_line diff-line-num old" data-linenumber="328" style="width: 35px; color: rgba(5,5,6,.24); border-right-width: 1px; border-right-color: #fac5cd; border-right-style: solid; padding: inherit;" align="right" bgcolor="#f9d7dc">
328
</td>
<td class="new_line diff-line-num old" data-linenumber="327" style="width: 35px; color: rgba(5,5,6,.24); border-right-width: 1px; border-right-color: #fac5cd; border-right-style: solid; padding: inherit;" align="right" bgcolor="#f9d7dc">
</td>
<td class="line_content old" style="padding: inherit;" bgcolor="#fbe9eb"><pre style='display: block; font-size: 14px; color: #3a383d; position: relative; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: break-all; word-wrap: break-word; background-color: inherit; border-radius: 2px; margin: 0; padding: 0; border: inherit solid #dcdbd9;'>-<span class="line" data-lang="c"> <span class="n" style="color: #333333;">t</span><span class="o" style="font-weight: 600;">-></span><span class="n" style="color: #333333;">t_week</span> <span class="o" style="font-weight: 600;">=</span> <span class="p">(</span><span class="kt" style="color: #445588; font-weight: 600;">unsigned</span> <span class="kt" style="color: #445588; font-weight: 600;">short</span><span class="p">)(</span><span class="n" style="color: #333333;">t</span><span class="o" style="font-weight: 600;">-></span><span class="n" style="color: #333333;">t_weekleap</span> <span class="o" style="font-weight: 600;">+</span> <span class="n" style="color: #333333;">GPSWEEKS</span><span class="p">);</span></span>
</pre></td>
</tr>
<tr class="line_holder new" style="line-height: 1.6;">
<td class="old_line diff-line-num new" data-linenumber="329" style="width: 35px; color: rgba(5,5,6,.24); border-right-width: 1px; border-right-color: #c7f0d2; border-right-style: solid; padding: inherit;" align="right" bgcolor="#ddfbe6">
</td>
<td class="new_line diff-line-num new" data-linenumber="327" style="width: 35px; color: rgba(5,5,6,.24); border-right-width: 1px; border-right-color: #c7f0d2; border-right-style: solid; padding: inherit;" align="right" bgcolor="#ddfbe6">
327
</td>
<td class="line_content new" style="padding: inherit;" bgcolor="#ecfdf0"><pre style='display: block; font-size: 14px; color: #3a383d; position: relative; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: break-all; word-wrap: break-word; background-color: inherit; border-radius: 2px; margin: 0; padding: 0; border: inherit solid #dcdbd9;'>+<span class="line" data-lang="c"> <span class="n" style="color: #333333;">t</span><span class="o" style="font-weight: 600;">-></span><span class="n" style="color: #333333;">t_week</span> <span class="o" style="font-weight: 600;">+=</span> <span class="n" style="color: #333333;">GPSWEEKS</span><span class="p">;</span></span>
</pre></td>
</tr>
<tr class="line_holder" style="line-height: 1.6;">
<td class="old_line diff-line-num" data-linenumber="329" style="width: 35px; color: rgba(5,5,6,.24); border-right-width: 1px; border-right-color: #ecebea; border-right-style: solid; padding: inherit;" align="right" bgcolor="#f7f7f5">
329
</td>
<td class="new_line diff-line-num" data-linenumber="328" style="width: 35px; color: rgba(5,5,6,.24); border-right-width: 1px; border-right-color: #ecebea; border-right-style: solid; padding: inherit;" align="right" bgcolor="#f7f7f5">
328
</td>
<td class="line_content" style="padding: inherit;"><pre style='display: block; font-size: 14px; color: #3a383d; position: relative; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: break-all; word-wrap: break-word; background-color: inherit; border-radius: 2px; margin: 0; padding: 0; border: inherit solid #dcdbd9;'> <span class="line" data-lang="c"> <span class="p">}</span></span>
</pre></td>
</tr>
<tr class="line_holder" style="line-height: 1.6;">
<td class="old_line diff-line-num" data-linenumber="330" style="width: 35px; color: rgba(5,5,6,.24); border-right-width: 1px; border-right-color: #ecebea; border-right-style: solid; padding: inherit;" align="right" bgcolor="#f7f7f5">
330
</td>
<td class="new_line diff-line-num" data-linenumber="329" style="width: 35px; color: rgba(5,5,6,.24); border-right-width: 1px; border-right-color: #ecebea; border-right-style: solid; padding: inherit;" align="right" bgcolor="#f7f7f5">
329
</td>
<td class="line_content" style="padding: inherit;"><pre style='display: block; font-size: 14px; color: #3a383d; position: relative; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: break-all; word-wrap: break-word; background-color: inherit; border-radius: 2px; margin: 0; padding: 0; border: inherit solid #dcdbd9;'> <span class="line" data-lang="c"></span>
</pre></td>
</tr>
<tr class="line_holder" style="line-height: 1.6;">
<td class="old_line diff-line-num" data-linenumber="331" style="width: 35px; color: rgba(5,5,6,.24); border-right-width: 1px; border-right-color: #ecebea; border-right-style: solid; padding: inherit;" align="right" bgcolor="#f7f7f5">
331
</td>
<td class="new_line diff-line-num" data-linenumber="330" style="width: 35px; color: rgba(5,5,6,.24); border-right-width: 1px; border-right-color: #ecebea; border-right-style: solid; padding: inherit;" align="right" bgcolor="#f7f7f5">
330
</td>
<td class="line_content" style="padding: inherit;"><pre style='display: block; font-size: 14px; color: #3a383d; position: relative; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: break-all; word-wrap: break-word; background-color: inherit; border-radius: 2px; margin: 0; padding: 0; border: inherit solid #dcdbd9;'> <span class="line" data-lang="c"> <span class="n" style="color: #333333;">lbp</span> <span class="o" style="font-weight: 600;">=</span> <span class="p">(</span><span class="kt" style="color: #445588; font-weight: 600;">unsigned</span> <span class="kt" style="color: #445588; font-weight: 600;">char</span> <span class="o" style="font-weight: 600;">*</span><span class="p">)</span><span class="o" style="font-weight: 600;">&</span><span class="n" style="color: #333333;">mb</span><span class="p">(</span><span class="mi" style="color: #009999;">14</span><span class="p">);</span> <span class="cm" style="color: #999988; font-style: italic;">/* last update time */</span></span>
</pre></td>
</tr>
</table>
<br>
</li>
</div>
<div class="footer" style="margin-top: 10px;">
<p style="font-size: small; color: #646163;">
—
<br>
<a href="https://gitlab.com/NTPsec/ntpsec/-/commit/b6c8155e1c862bdfe79c381b8a96cdc6859c6f57">View it on GitLab</a>.
<br>
You're receiving this email because of your account on <a target="_blank" rel="noopener noreferrer" href="https://gitlab.com">gitlab.com</a>. <a href="https://gitlab.com/-/profile/notifications" target="_blank" rel="noopener noreferrer" class="mng-notif-link">Manage all notifications</a> · <a href="https://gitlab.com/help" target="_blank" rel="noopener noreferrer" class="help-link">Help</a>
<span style="color: transparent; font-size: 0; display: none; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0;">
Notification message regarding https://gitlab.com/NTPsec/ntpsec/-/commit/b6c8155e1c862bdfe79c381b8a96cdc6859c6f57 at 34a2f84feadff5ae1472416eab2fc6b4
</span>
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Commit","url":"https://gitlab.com/NTPsec/ntpsec/-/commit/b6c8155e1c862bdfe79c381b8a96cdc6859c6f57"}}</script>
</p>
</div>
</body>
</html>