Ticket #2989 (closed defect: wontfix)

Opened 11 years ago

Last modified 9 years ago

Fix code which depends on signed overflow in C (which isn't defined in C)

Reported by: vda Owned by:
Priority: major Milestone:
Component: mc-vfs Version: master
Keywords: Cc:
Blocked By: Blocking:
Branch state: no branch Votes for changeset:

Description

The warnings are:

src/vfs/smbfs/helpers/lib/time.c:177:16: warning: assuming signed overflow does not occur when assuming that (X - c) > X is always false [-Wstrict-overflow]
src/vfs/smbfs/helpers/lib/time.c:181:16: warning: assuming signed overflow does not occur when assuming that (X + c) < X is always false [-Wstrict-overflow]

and they seems to be valid, and gcc people do intend to make gcc play tricks under "signed overflow is undefined, so we can assume it never happens" banner.

The patch was sent by email with subject line
"Fix code which depends on signed overflow in C (which isn't defined in C)".
For your easy reference, it is just:

             /* no entry will cover more than 6 months */
-            low = t - MAX_DST_WIDTH / 2;
-            if (t < low)
+            if (t > TIME_T_MIN + MAX_DST_WIDTH / 2)
+                low = t - MAX_DST_WIDTH / 2;
+            else
                 low = TIME_T_MIN;

-            high = t + MAX_DST_WIDTH / 2;
-            if (high < t)
+            if (t < TIME_T_MAX - MAX_DST_WIDTH / 2)
+                high = t + MAX_DST_WIDTH / 2;
+            else
                 high = TIME_T_MAX;

Change History

comment:1 Changed 11 years ago by andrew_b

  • Component changed from mc-core to mc-vfs

comment:2 Changed 9 years ago by andrew_b

  • Status changed from new to closed
  • Resolution set to wontfix
  • Milestone Future Releases deleted

Samba code used in mc is ancient and should be rewritten totally (see #1).

Note: See TracTickets for help on using tickets.