mirror of
https://git.proxmox.com/git/libgit2
synced 2025-08-12 22:21:35 +00:00
coverity: add nodefs for abort macros
Add nodefs for macros that abort the current flow due to errors. This includes macros that trigger on integer overflows and for the version check macro. This aids Coverity as we point out that these paths will cause a fatal error.
This commit is contained in:
parent
c1b75f05ad
commit
5981ab1d70
@ -6,3 +6,20 @@
|
||||
*/
|
||||
|
||||
#nodef GITERR_CHECK_ALLOC(ptr) if (ptr == NULL) { __coverity_panic__(); }
|
||||
|
||||
#nodef GITERR_CHECK_ALLOC_ADD(out, one, two) \
|
||||
if (GIT_ADD_SIZET_OVERFLOW(out, one, two)) { __coverity_panic__(); }
|
||||
|
||||
#nodef GITERR_CHECK_ALLOC_ADD3(out, one, two, three) \
|
||||
if (GIT_ADD_SIZET_OVERFLOW(out, one, two) || \
|
||||
GIT_ADD_SIZET_OVERFLOW(out, *(out), three)) { __coverity_panic__(); }
|
||||
|
||||
#nodef GITERR_CHECK_ALLOC_ADD4(out, one, two, three, four) \
|
||||
if (GIT_ADD_SIZET_OVERFLOW(out, one, two) || \
|
||||
GIT_ADD_SIZET_OVERFLOW(out, *(out), three) || \
|
||||
GIT_ADD_SIZET_OVERFLOW(out, *(out), four)) { __coverity_panic__(); }
|
||||
|
||||
#nodef GITERR_CHECK_ALLOC_MULTIPLY(out, nelem, elsize) \
|
||||
if (GIT_MULTIPLY_SIZET_OVERFLOW(out, nelem, elsize)) { __coverity_panic__(); }
|
||||
|
||||
#nodef GITERR_CHECK_VERSION(S,V,N) if (giterr__check_version(S,V,N) < 0) { __coverity_panic__(); }
|
||||
|
Loading…
Reference in New Issue
Block a user