summaryrefslogtreecommitdiff
path: root/libelf/libelfP.h
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2014-01-17 20:38:01 +0100
committerMark Wielaard <mjw@redhat.com>2014-01-23 11:31:53 +0100
commita9039623c272f458a53f09009c2a0e1d6e60491d (patch)
tree89fbb96c4a083aaecf960871e02a4fd99085245f /libelf/libelfP.h
parent720383c53b435de6647edd78060dd7d38ade25a5 (diff)
downloadelfutils-a9039623c272f458a53f09009c2a0e1d6e60491d.tar.gz
robustify: libelf gelf define INVALID_NDX macro.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
Diffstat (limited to 'libelf/libelfP.h')
-rw-r--r--libelf/libelfP.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/libelf/libelfP.h b/libelf/libelfP.h
index 7da23709..52cf7457 100644
--- a/libelf/libelfP.h
+++ b/libelf/libelfP.h
@@ -587,4 +587,8 @@ extern uint32_t __libelf_crc32 (uint32_t crc, unsigned char *buf, size_t len)
/* Align offset to 4 bytes as needed for note name and descriptor data. */
#define NOTE_ALIGN(n) (((n) + 3) & -4U)
+/* Convenience macro. */
+#define INVALID_NDX(ndx, type, data) \
+ unlikely ((data)->d_size / sizeof (type) <= (unsigned int) (ndx))
+
#endif /* libelfP.h */