From e5d33dfd3433253bb8574f0b80a5c216f51ab7f3 Mon Sep 17 00:00:00 2001 From: Sasha Goldshtein Date: Sat, 11 Feb 2017 19:35:14 -0500 Subject: [PATCH] cc: Fix SEGV when there is no build-id section --- src/cc/bcc_elf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cc/bcc_elf.c b/src/cc/bcc_elf.c index 8a5136f..95ff424 100644 --- a/src/cc/bcc_elf.c +++ b/src/cc/bcc_elf.c @@ -241,7 +241,7 @@ static int find_debuglink(Elf *e, char **debug_file, unsigned int *crc) { static int find_buildid(Elf *e, char *buildid) { Elf_Data *data = get_section_elf_data(e, ".note.gnu.build-id"); - if (data->d_size <= 16 || strcmp((char *)data->d_buf + 12, "GNU")) + if (!data || data->d_size <= 16 || strcmp((char *)data->d_buf + 12, "GNU")) return 0; char *buf = (char *)data->d_buf + 16; -- 2.7.4