Merge pull request #4571 from jacquesg/overflow Integer overflow
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2e98bbc..2ca5354 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -221,6 +221,7 @@ ELSE ()
ENABLE_WARNINGS(strict-aliasing)
ENABLE_WARNINGS(strict-prototypes)
ENABLE_WARNINGS(declaration-after-statement)
+ ENABLE_WARNINGS(shift-count-overflow)
DISABLE_WARNINGS(unused-const-variable)
DISABLE_WARNINGS(unused-function)
diff --git a/include/git2/diff.h b/include/git2/diff.h
index 99a94bb..86009f5 100644
--- a/include/git2/diff.h
+++ b/include/git2/diff.h
@@ -200,18 +200,18 @@ typedef enum {
/** Use the "patience diff" algorithm */
GIT_DIFF_PATIENCE = (1u << 28),
/** Take extra time to find minimal diff */
- GIT_DIFF_MINIMAL = (1 << 29),
+ GIT_DIFF_MINIMAL = (1u << 29),
/** Include the necessary deflate / delta information so that `git-apply`
* can apply given diff information to binary files.
*/
- GIT_DIFF_SHOW_BINARY = (1 << 30),
+ GIT_DIFF_SHOW_BINARY = (1u << 30),
/** Use a heuristic that takes indentation and whitespace into account
* which generally can produce better diffs when dealing with ambiguous
* diff hunks.
*/
- GIT_DIFF_INDENT_HEURISTIC = (1 << 31),
+ GIT_DIFF_INDENT_HEURISTIC = (1u << 31),
} git_diff_option_t;
/**