{"thread":{"id":"9551","subject":"[PATCH] Check for large pack offsets could be optimized away","startedAt":"2007-08-16T07:58:51Z","lastAt":"2007-08-16T07:58:51Z","messageCount":1,"participants":["Marco Costalba"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"50853","messageId":"e5bfff550708160058q6674f832m641647cd883accfc@mail.gmail.com","threadId":"9551","inReplyTo":null,"subject":"[PATCH] Check for large pack offsets could be optimized away","fromName":"Marco Costalba","fromEmail":"mcostalba@gmail.com","sentAt":"2007-08-16T07:58:51Z","receivedAt":"2007-08-16T07:58:51Z","isPatch":true,"sender":{"key":"mcostalba@gmail.com","avatar":null},"body":"Without this fix gcc 4.2.1 warns with:\n\nwarning: assuming signed overflow does not occur\nwhen assuming that (X + c) < X is always false\n\nSigned-off-by: Marco Costalba <mcostalba@gmail.com>\n---\n sha1_file.c |    3 ++-\n 1 files changed, 2 insertions(+), 1 deletions(-)\n\ndiff --git a/sha1_file.c b/sha1_file.c\nindex b219d4d..ba29000 100644\n--- a/sha1_file.c\n+++ b/sha1_file.c\n@@ -524,7 +524,8 @@ static int check_packed_git_idx\n \t\tif (idx_size != min_size) {\n \t\t\t/* make sure we can deal with large pack offsets */\n \t\t\toff_t x = 0x7fffffffUL, y = 0xffffffffUL;\n-\t\t\tif (x > (x + 1) || y > (y + 1)) {\n+\t\t\toff_t x1 = x + 1, y1 = y + 1;\n+\t\t\tif (x > x1 || y > y1) {\n  \t\t\t\tmunmap(idx_map, idx_size);\n \t\t\t\treturn error(\"pack too large for current definition of off_t in %s\", path);\n \t\t\t}\n-- \n1.5.3.rc4.67.gf9286\n"}]}