Commit 3a5a07fc by Edward Thomson

idxmap: safely cast down to khiter_t

parent a080037c
...@@ -70,7 +70,8 @@ void git_idxmap_icase_clear(git_idxmap_icase *map) ...@@ -70,7 +70,8 @@ void git_idxmap_icase_clear(git_idxmap_icase *map)
int git_idxmap_resize(git_idxmap *map, size_t size) int git_idxmap_resize(git_idxmap *map, size_t size)
{ {
if (kh_resize(idx, map, size) < 0) { if (!git__is_uint32(size) ||
kh_resize(idx, map, (khiter_t)size) < 0) {
git_error_set_oom(); git_error_set_oom();
return -1; return -1;
} }
...@@ -79,7 +80,8 @@ int git_idxmap_resize(git_idxmap *map, size_t size) ...@@ -79,7 +80,8 @@ int git_idxmap_resize(git_idxmap *map, size_t size)
int git_idxmap_icase_resize(git_idxmap_icase *map, size_t size) int git_idxmap_icase_resize(git_idxmap_icase *map, size_t size)
{ {
if (kh_resize(idxicase, map, size) < 0) { if (!git__is_uint32(size) ||
kh_resize(idxicase, map, (khiter_t)size) < 0) {
git_error_set_oom(); git_error_set_oom();
return -1; return -1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment