libgit2/libgit2 — pull request #2167 by mekishizufu (2014-03-06 22:10:46+00:00)
Title: Fun with memory access

Hey guys!

The patches fix some memory access issues I found.

- **git_oid_fromstrn**: Make sure not to read beyond the end of the buffer when given an empty oid string.

- **blame**: Previously the `hunk_byfinalline_search_cmp` function was called with different data types (`size_t` and `uint32_t`) for the `key` argument but expected only the former resulting in an invalid memory access when passed the latter on a 64 bit machine. The patch makes sure that the function is called and works with the same type (`size_t`).
I'm not sure if this is the best way to fix it but it seemed like a pretty straight forward and isolated change.

GCC/Clang seems to be happy about it but I don't have a windows machine to see the MSVC's opinion.