• Milian Wolff's avatar
    perf buildid-list: Initialize zstd_data · c67d7349
    Milian Wolff authored
    Fixes segmentation fault when trying to obtain buildid list (e.g. via
    perf-archive) from a zstd-compressed `perf.data` file:
    
    ```
        $ perf record -z ls
        ...
        [ perf record: Captured and wrote 0,010 MB perf.data, compressed (original 0,001 MB, ratio is 2,190) ]
        $ memcheck perf buildid-list
        ...
        ==57268== Invalid read of size 4
        ==57268==    at 0x5260D88: ZSTD_decompressStream (in /usr/lib/libzstd.so.1.4.9)
        ==57268==    by 0x4BB51B: zstd_decompress_stream (zstd.c:100)
        ==57268==    by 0x425C6C: perf_session__process_compressed_event (session.c:73)
        ==57268==    by 0x427450: perf_session__process_user_event (session.c:1631)
        ==57268==    by 0x42A609: reader__process_events (session.c:2207)
        ==57268==    by 0x42A609: __perf_session__process_events (session.c:2264)
        ==57268==    by 0x42A609: perf_session__process_events (session.c:2297)
        ==57268==    by 0x343A62: perf_session__list_build_ids (builtin-buildid-list.c:88)
        ==57268==    by 0x343A62: cmd_buildid_list (builtin-buildid-list.c:120)
        ==57268==    by 0x3C7732: run_builtin (perf.c:313)
        ==57268==    by 0x331157: handle_internal_command (perf.c:365)
        ==57268==    by 0x331157: run_argv (perf.c:409)
        ==57268==    by 0x331157: main (perf.c:539)
        ==57268==  Address 0x7470 is not stack'd, malloc'd or (recently) free'd
    ```
    Signed-off-by: default avatarMilian Wolff <milian.wolff@kdab.com>
    Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
    Link: http://lore.kernel.org/lkml/20210429185759.59870-1-milian.wolff@kdab.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    c67d7349
builtin-buildid-list.c 3.21 KB