{"thread":{"id":"47799","subject":"[BUG] Integer overflow when supplying large context value to diff --unified","startedAt":"2018-02-09T15:08:42Z","lastAt":"2018-02-09T15:08:42Z","messageCount":1,"participants":["Branko Majic"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"338881","messageId":"20180209160147.3f54a362@majic.rs","threadId":"47799","inReplyTo":null,"subject":"[BUG] Integer overflow when supplying large context value to diff --unified","fromName":"Branko Majic","fromEmail":"branko@majic.rs","sentAt":"2018-02-09T15:01:47Z","receivedAt":"2018-02-09T15:08:42Z","isPatch":false,"sender":{"key":"branko@majic.rs","avatar":null},"body":"Hello,\n\nGit versions tested: 2.13.6, 2.1.4\n\nWhen passing-in a large context value for the --unified option for\ngit-diff, Git will produce an invalid-looking range information for\nhunks.\n\nFor example, if running 'git diff --unified=10 HEAD^', the output will\ninclude (this is just a run against my local git repo):\n\n@@ -42,23 +42,23 @@ master_doc = 'index'\n\nNote the numbers for denoting begin/end line etc \"look fine\"(they're\nwithin the expected numeric range).\n\nNow, if we pass on a big value to it (2 to the power of 32 divided by 2,\ne.g. enough so that signed long int can't hold it without overflowing),\ne.g. 'git diff --unified=2147483648 HEAD^', the output will include\n(again, just a sample):\n\n@@ -2147483700,4294967295- +2147483700,4294967295- @@\n\nNote that the begin/end line numbers are way out of range. The diff\nitself will actually contain no context lines.\n\nBest regards\n\n-- \nBranko Majic\nXMPP: branko@majic.rs\nPlease use only Free formats when sending attachments to me.\n\nБранко Мајић\nXMPP: branko@majic.rs\nМолим вас да додатке шаљете искључиво у слободним форматима.\n"}]}