diff options
author | Patrick Steinhardt <ps@pks.im> | 2019-10-21 18:56:59 +0200 |
---|---|---|
committer | Patrick Steinhardt <ps@pks.im> | 2019-10-21 20:07:42 +0200 |
commit | 37141ff7701e45ab0d97f311a4e0cc95cf527aa9 (patch) | |
tree | 1f9353c309550c7d3128570f007fdfa8e3de5d71 /src/commit.c | |
parent | 468e3ddc344d6374a615fb2199005956ad0eb531 (diff) | |
download | libgit2-37141ff7701e45ab0d97f311a4e0cc95cf527aa9.tar.gz |
patch_parse: detect overflow when calculating old/new line position
When the patch contains lines close to INT_MAX, then it may happen that
we end up with an integer overflow when calculating the line of the
current diff hunk. Reject such patches as unreasonable to avoid the
integer overflow.
As the calculation is performed on integers, we introduce two new
helpers `git__add_int_overflow` and `git__sub_int_overflow` that perform
the integer overflow check in a generic way.
Diffstat (limited to 'src/commit.c')
0 files changed, 0 insertions, 0 deletions