* [BUG] Integer overflow when supplying large context value to diff --unified
@ 2018-02-09 15:01 Branko Majic
0 siblings, 0 replies; only message in thread
From: Branko Majic @ 2018-02-09 15:01 UTC (permalink / raw)
To: git
[-- Attachment #1: Type: text/plain, Size: 1181 bytes --]
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@majic.rs
Please use only Free formats when sending attachments to me.
Бранко Мајић
XMPP: branko@majic.rs
Молим вас да додатке шаљете искључиво у слободним форматима.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2018-02-09 15:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-09 15:01 [BUG] Integer overflow when supplying large context value to diff --unified Branko Majic
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).