Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
mc-butler opened this issue Mar 28, 2013 · 2 comments
Closed
Labels
area: vfs Virtual File System support prio: medium Has the potential to affect progress

Comments

@mc-butler
Copy link

Important

This issue was migrated from Trac:

Origin https://midnight-commander.org/ticket/2989
Reporter vda (@dvlasenk)

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;
@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Aug 31, 2013 at 8:27 UTC (comment 1)

  • Component changed from mc-core to mc-vfs

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Apr 5, 2015 at 7:03 UTC (comment 2)

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

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

@mc-butler mc-butler closed this as not planned Won't fix, can't repro, duplicate, stale Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: vfs Virtual File System support prio: medium Has the potential to affect progress
Development

No branches or pull requests

1 participant