libvirt/src/cpu
Michal Privoznik 62cb9c335c cpu: Don't access invalid memory in virCPUx86Translate
Problem is that if there are no signatures for a CPU, then we
still allocate cpu->signatures (even though with size 0). Later,
we access cpu->signatures[0] if cpu->signatures is not NULL.

 Invalid read of size 4
    at 0x5F439D7: virCPUx86Translate (cpu_x86.c:2930)
    by 0x5F3C239: virCPUTranslate (cpu.c:927)
    by 0x57CE7A1: qemuProcessUpdateGuestCPU (qemu_process.c:5870)
    ...
  Address 0xf752d40 is 0 bytes after a block of size 0 alloc'd
    at 0x4C30EC6: calloc (vg_replace_malloc.c:711)
    by 0x5DBDE4E: virAllocN (viralloc.c:190)
    by 0x5F3E4FA: x86ModelCopySignatures (cpu_x86.c:990)
    by 0x5F3E60F: x86ModelCopy (cpu_x86.c:1008)
    by 0x5F3E7CB: x86ModelFromCPU (cpu_x86.c:1068)
    by 0x5F4397E: virCPUx86Translate (cpu_x86.c:2922)
    by 0x5F3C239: virCPUTranslate (cpu.c:927)
    by 0x57CE7A1: qemuProcessUpdateGuestCPU (qemu_process.c:5870)
    ...

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2019-03-07 15:30:40 +01:00
..
cpu_arm.c Remove all Author(s): lines from source file headers 2018-12-13 16:08:38 +00:00
cpu_arm.h Enforce a standard header file guard symbol name 2018-12-14 10:47:13 +00:00
cpu_map.c Remove all Author(s): lines from source file headers 2018-12-13 16:08:38 +00:00
cpu_map.h Enforce a standard header file guard symbol name 2018-12-14 10:47:13 +00:00
cpu_ppc64_data.h Enforce a standard header file guard symbol name 2018-12-14 10:47:13 +00:00
cpu_ppc64.c Remove all Author(s): lines from source file headers 2018-12-13 16:08:38 +00:00
cpu_ppc64.h Enforce a standard header file guard symbol name 2018-12-14 10:47:13 +00:00
cpu_s390.c Remove all Author(s): lines from source file headers 2018-12-13 16:08:38 +00:00
cpu_s390.h Enforce a standard header file guard symbol name 2018-12-14 10:47:13 +00:00
cpu_x86_data.h Enforce a standard header file guard symbol name 2018-12-14 10:47:13 +00:00
cpu_x86.c cpu: Don't access invalid memory in virCPUx86Translate 2019-03-07 15:30:40 +01:00
cpu_x86.h cpu_x86: Add virCPUx86DataGetSignature for tests 2019-03-05 14:47:49 +01:00
cpu.c Remove all Author(s): lines from source file headers 2018-12-13 16:08:38 +00:00
cpu.h Enforce a standard header file guard symbol name 2018-12-14 10:47:13 +00:00
Makefile.inc.am