mirror of
https://git.proxmox.com/git/libgit2
synced 2025-06-23 21:38:19 +00:00
pack: don't allow a negative offset
This commit is contained in:
parent
ea9e00cb5c
commit
6d97beb91f
@ -365,9 +365,14 @@ static unsigned char *pack_window_open(
|
|||||||
* pointless to ask for an offset into the middle of that
|
* pointless to ask for an offset into the middle of that
|
||||||
* hash, and the pack_window_contains function above wouldn't match
|
* hash, and the pack_window_contains function above wouldn't match
|
||||||
* don't allow an offset too close to the end of the file.
|
* don't allow an offset too close to the end of the file.
|
||||||
|
*
|
||||||
|
* Don't allow a negative offset, as that means we've wrapped
|
||||||
|
* around.
|
||||||
*/
|
*/
|
||||||
if (offset > (p->mwf.size - 20))
|
if (offset > (p->mwf.size - 20))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
if (offset < 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
return git_mwindow_open(&p->mwf, w_cursor, offset, 20, left);
|
return git_mwindow_open(&p->mwf, w_cursor, offset, 20, left);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user