• Milian Wolff's avatar
    perf script: Initialize zstd_data · b13b04d9
    Milian Wolff authored
    Fixes segmentation fault when trying to interpret zstd-compressed data
    with perf script:
    
    ```
      $ 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 script
      ...
      ==67911== Invalid read of size 4
      ==67911==    at 0x5568188: ZSTD_decompressStream (in /usr/lib/libzstd.so.1.4.5)
      ==67911==    by 0x6E726B: zstd_decompress_stream (zstd.c:100)
      ==67911==    by 0x65729C: perf_session__process_compressed_event (session.c:72)
      ==67911==    by 0x6598E8: perf_session__process_user_event (session.c:1583)
      ==67911==    by 0x65BA59: reader__process_events (session.c:2177)
      ==67911==    by 0x65BA59: __perf_session__process_events (session.c:2234)
      ==67911==    by 0x65BA59: perf_session__process_events (session.c:2267)
      ==67911==    by 0x5A7397: __cmd_script (builtin-script.c:2447)
      ==67911==    by 0x5A7397: cmd_script (builtin-script.c:3840)
      ==67911==    by 0x5FE9D2: run_builtin (perf.c:312)
      ==67911==    by 0x711627: handle_internal_command (perf.c:364)
      ==67911==    by 0x711627: run_argv (perf.c:408)
      ==67911==    by 0x711627: main (perf.c:538)
      ==67911==  Address 0x71d8 is not stack'd, malloc'd or (recently) free'd
    ```
    Signed-off-by: default avatarMilian Wolff <milian.wolff@kdab.com>
    Acked-by: default avatarAlexey Budankov <alexey.budankov@linux.intel.com>
    Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    LPU-Reference: 20200612230333.72140-1-milian.wolff@kdab.com
    Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    b13b04d9
builtin-script.c 101 KB