telf: Fix uninitialized pointer read 38/259738/1
authorMateusz Moscicki <m.moscicki2@partner.samsung.com>
Fri, 11 Jun 2021 10:39:29 +0000 (12:39 +0200)
committerMateusz Moscicki <m.moscicki2@partner.samsung.com>
Fri, 11 Jun 2021 10:39:29 +0000 (12:39 +0200)
Change-Id: I8bf8dbed9af82c895ec3040eeafdb03a0d74fd04

src/crash-stack/unwind.c
src/shared/telf.c

index 44bff5d..3a2b455 100644 (file)
@@ -79,6 +79,10 @@ static FILE *debug;
 static Elf *elf_start(int fd, char *image, uint64_t size)
 {
     Elf *elf = malloc(sizeof(Elf));
+    if (elf == NULL) {
+           _E("Out of memory");
+           return NULL;
+    }
 
     if (fd > 0) {
         if (!teu_begin(fd, elf))
index 09508c1..87b5209 100644 (file)
@@ -174,6 +174,7 @@ bool teu_begin_memory(void *memory, Elf *elf)
        assert(elf);
 
        elf->status = TEU_MEMORY;
+       elf->data = memory;
 
        if (!teu_init(elf))
                return false;