mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-11 16:07:08 +00:00
Fix #534: 64-bit issues in Windows
off_t is always 32 bits in Windows, which is beyond stupid, but we just don't care anymore because we're using `git_off_t` which is assured to be 64 bits on all platforms, regardless of compilation mode. Just ensure that no casts to `off_t` are performed. Also, the check for `off_t` overflows has been dropped, once again, because the size of our offsets is always 64 bits on all platforms. Fixes #534
This commit is contained in:
parent
c1c399cf27
commit
1af56d7d7e
@ -157,13 +157,6 @@ static int pack_index_check(const char *path, struct git_pack_file *p)
|
|||||||
git_futils_mmap_free(&p->index_map);
|
git_futils_mmap_free(&p->index_map);
|
||||||
return git__throw(GIT_EOBJCORRUPTED, "Failed to check index. Wrong index size");
|
return git__throw(GIT_EOBJCORRUPTED, "Failed to check index. Wrong index size");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure that off_t is big enough to access the whole pack...
|
|
||||||
* Is this an issue in libgit2? It shouldn't. */
|
|
||||||
if (idx_size != min_size && (sizeof(off_t) <= 4)) {
|
|
||||||
git_futils_mmap_free(&p->index_map);
|
|
||||||
return git__throw(GIT_EOSERR, "Failed to check index. off_t not big enough to access the whole pack");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
p->index_version = version;
|
p->index_version = version;
|
||||||
@ -619,7 +612,7 @@ int git_packfile_check(struct git_pack_file **pack_out, const char *path)
|
|||||||
/* ok, it looks sane as far as we can check without
|
/* ok, it looks sane as far as we can check without
|
||||||
* actually mapping the pack file.
|
* actually mapping the pack file.
|
||||||
*/
|
*/
|
||||||
p->mwf.size = (off_t)st.st_size;
|
p->mwf.size = st.st_size;
|
||||||
p->pack_local = 1;
|
p->pack_local = 1;
|
||||||
p->mtime = (git_time_t)st.st_mtime;
|
p->mtime = (git_time_t)st.st_mtime;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user