diff options
author | René Scharfe <l.s.r@web.de> | 2017-10-01 16:45:13 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-10-02 13:14:33 +0900 |
commit | 7099153e8d7d0ed228c3a63cb06912c13c1082e5 (patch) | |
tree | 8a59660c29f472b60f9c3d31ae2b334faffb2a63 /perl/Git/I18N.pm | |
parent | Git 2.14.2 (diff) | |
download | tgif-7099153e8d7d0ed228c3a63cb06912c13c1082e5.tar.xz |
tag: avoid NULL pointer arithmetic
lookup_blob() etc. can return NULL if the referenced object isn't of the
expected type. In theory it's wrong to reference the object member in
that case. In practice it's OK because it's located at offset 0 for all
types, so the pointer arithmetic (NULL + 0) is optimized out by the
compiler. The issue is reported by Clang's AddressSanitizer, though.
Avoid the ASan error by casting the results of the lookup functions to
struct object pointers. That works fine with NULL pointers as well. We
already rely on the object member being first in all object types in
other places in the code.
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'perl/Git/I18N.pm')
0 files changed, 0 insertions, 0 deletions