[BUG] Integer overflow when supplying large context value to diff --unified
- Date: Fri, 9 Feb 2018 16:01:47 +0100
- From: Branko Majic <branko@xxxxxxxx>
- Subject: [BUG] Integer overflow when supplying large context value to diff --unified
Hello, Git versions tested: 2.13.6, 2.1.4 When passing-in a large context value for the --unified option for git-diff, Git will produce an invalid-looking range information for hunks. For example, if running 'git diff --unified=10 HEAD^', the output will include (this is just a run against my local git repo): @@ -42,23 +42,23 @@ master_doc = 'index' Note the numbers for denoting begin/end line etc "look fine"(they're within the expected numeric range). Now, if we pass on a big value to it (2 to the power of 32 divided by 2, e.g. enough so that signed long int can't hold it without overflowing), e.g. 'git diff --unified=2147483648 HEAD^', the output will include (again, just a sample): @@ -2147483700,4294967295- +2147483700,4294967295- @@ Note that the begin/end line numbers are way out of range. The diff itself will actually contain no context lines. Best regards -- Branko Majic XMPP: branko@xxxxxxxx Please use only Free formats when sending attachments to me. Бранко Мајић XMPP: branko@xxxxxxxx Молим вас да додатке шаљете искључиво у слободним форматима.
Description: OpenPGP digital signature
- Prev by Date: Re: [PATCH 2/3] t: teach 'test_must_fail' to save the command's stderr to a file
- Next by Date: should "git bisect skip" not visually reduce number of revisions left?
- Previous by thread: [PATCH v6 0/7] convert: add support for different encodings
- Next by thread: should "git bisect skip" not visually reduce number of revisions left?