diff options
| author | lhchavez <lhchavez@lhchavez.com> | 2017-12-15 15:01:50 +0000 |
|---|---|---|
| committer | lhchavez <lhchavez@lhchavez.com> | 2017-12-15 15:01:50 +0000 |
| commit | 53f2c6b1d8907e1716ea4eb643868da445e36f54 (patch) | |
| tree | e113813050a974cac0dc1b44879704199a4c2ce0 /src/pack.c | |
| parent | e7fac2af238ec1eff706d6605985ee5bdfaeb2ea (diff) | |
| download | libgit2-53f2c6b1d8907e1716ea4eb643868da445e36f54.tar.gz | |
Simplified overflow condition
Diffstat (limited to 'src/pack.c')
| -rw-r--r-- | src/pack.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/pack.c b/src/pack.c index e0a393817..b87d22d53 100644 --- a/src/pack.c +++ b/src/pack.c @@ -944,11 +944,9 @@ git_off_t get_delta_base( c = base_info[used++]; unsigned_base_offset = (unsigned_base_offset << 7) + (c & 127); } - if ((size_t)delta_obj_offset <= unsigned_base_offset) + if (unsigned_base_offset == 0 || (size_t)delta_obj_offset <= unsigned_base_offset) return 0; /* out of bound */ base_offset = delta_obj_offset - unsigned_base_offset; - if (base_offset >= delta_obj_offset) - return 0; /* out of bound */ *curpos += used; } else if (type == GIT_OBJ_REF_DELTA) { /* If we have the cooperative cache, search in it first */ |
