Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F150193654
D41771.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
713 B
Referenced Files
None
Subscribers
None
D41771.id.diff
View Options
diff --git a/usr.bin/bsdiff/bspatch/bspatch.c b/usr.bin/bsdiff/bspatch/bspatch.c
--- a/usr.bin/bsdiff/bspatch/bspatch.c
+++ b/usr.bin/bsdiff/bspatch/bspatch.c
@@ -36,6 +36,7 @@
#include <fcntl.h>
#include <libgen.h>
#include <limits.h>
+#include <stdckdint.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@@ -64,15 +65,8 @@
{
off_t result;
-#if __GNUC__ >= 5 || \
- (defined(__has_builtin) && __has_builtin(__builtin_add_overflow))
- if (__builtin_add_overflow(a, b, &result))
+ if (ckd_add(&result, a, b))
errx(1, "Corrupt patch");
-#else
- if ((b > 0 && a > OFF_MAX - b) || (b < 0 && a < OFF_MIN - b))
- errx(1, "Corrupt patch");
- result = a + b;
-#endif
return result;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Mar 31, 4:17 AM (6 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30618915
Default Alt Text
D41771.id.diff (713 B)
Attached To
Mode
D41771: bspatch: use C23 overflow checking math now that it is available
Attached
Detach File
Event Timeline
Log In to Comment