Skip to content

[BUG] [Fuzzing] testbench program exits with segmentation fault #3335

@ymdatta

Description

@ymdatta

Describe the bug
This bug was found when fuzzing the testbench using AFL fuzzer. For a fuzzed topology file input (i.e this topology was generated by the fuzzer) testbench exits with segmentation fault(core dumped) error.

To Reproduce

  1. Build the testbench from the using host-build-all.sh script from scripts directory.
  2. Download the topology file from here.
  3. Run the host-testbench.sh script from scripts directory to see if testbench works.
  4. Run the following command:
./tools/testbench/build_testbench/install/bin/testbench -r 48000 -R 48000 -i ./tools/test/audio/zeros_in.raw -o ./tools/testbench/build_testbench/volume_out.raw -t ./id_fuzz2_90_tplg.bin -b S16_LE

Reproduction Rate
All the time.

Expected behavior
If there is something wrong with topology file, the testbench should exit with some error code.

Screenshots or console output

  1. Segmentation Fault.
root@96ed1adedfaf:/home/sof/work/sof.git# ./tools/testbench/build_testbench/install/bin/testbench -r 48000 -R 48000 -i ./tools/test/audio/zeros_in.raw -o ./tools/testbench/build_testbench/volum
e_out.raw -b S16_LE -t ./id_fuzz2_90_tplg.bin 
unknown ipc_init()
unknown edf_scheduler_init()
debug: loading comp_id 0: widget PCM0P id 11
unknown comp new (null) type 1 id 1.0
debug: loading comp_id 1: widget PGA1.0 id 20
unknown comp new (null) type 8 id 1.1
unknown src_new()
debug: loading comp_id 2: widget BUF1.0 id 16
unknown buffer new size 0xc00 id 1.2 flags 0x0
debug: loading comp_id 3: widget BUF1.1 id 16
unknown buffer new size 0xc00 id 1.3 flags 0x0
debug: loading comp_id 4: widget SSP5.OUT id 12
unknown comp new (null) type 1 id 1.4
debug: loading comp_id 5: widget PIPELINE.1.SSP5.OUT id 17
unknown pipeline new pipe_id 1 period 1000 priority 0
loading route PCM0P -> BUF1.0
unknown connect buffer 2 as sink
loading route BUF1.0 -> PGA1.0
unknown connect buffer 2 as source
loading route PGA1.0 -> BUF1.0
unknown connect buffer 2 as sink
loading route BUF1.1 -> SSP5.OUT
unknown connect buffer 3 as source
unknown pipeline complete, clock freq 0Hz
Segmentation fault (core dumped)
  1. gdb trace log
Program received signal SIGSEGV, Segmentation fault.
0x00007fef7a7d226c in pipeline_for_each_comp (dir=0, ctx=0x7ffce8515750, current=0x564e8f9707b0) at /home/sof/work/sof.git/src/audio/pipeline.c:162
162             struct list_item *buffer_list = comp_buffer_list(current, dir);
(gdb) bt
#0  0x00007fef7a7d226c in pipeline_for_each_comp (dir=0, ctx=0x7ffce8515750, current=0x564e8f9707b0) at /home/sof/work/sof.git/src/audio/pipeline.c:162
#1  pipeline_comp_complete (current=0x564e8f9707b0, calling_buf=<optimized out>, ctx=0x7ffce8515750, dir=0) at /home/sof/work/sof.git/src/audio/pipeline.c:213
#2  0x00007ffce8515750 in ?? ()
#3  0x0000000000000000 in ?? ()

Metadata

Metadata

Assignees

Labels

P3Low-impact bugs or featuresbugSomething isn't working as expectedwon't fixThis will not be worked on atm (e.g. a bug closed for lack of user request, hardware etc)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions