diff options
author | Jakub Jelinek <jakub@redhat.com> | 2014-01-17 20:38:01 +0100 |
---|---|---|
committer | Mark Wielaard <mjw@redhat.com> | 2014-01-23 11:31:53 +0100 |
commit | a9039623c272f458a53f09009c2a0e1d6e60491d (patch) | |
tree | 89fbb96c4a083aaecf960871e02a4fd99085245f /libelf/libelfP.h | |
parent | 720383c53b435de6647edd78060dd7d38ade25a5 (diff) | |
download | elfutils-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.h | 4 |
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 */ |