Skip to content

segfault with empty input fastq #23

@sstrong99

Description

@sstrong99

When running with an empty input fastq (or fastqs for PE), the software fails with a segmentation fault. The output before the error is

...
p29745_AGTACGATCGAGTGTACAGTGAACA: 0
0
Mean depth: 0

Result: NEGATIVE (threshold: 0.1)

Duplication rate (may be overestimated since this is SE data): 0%
Segmentation fault

To reproduce:

gzip -c /dev/null > in1.fastq.gz
fastv --in1 in1.fastq.gz -k data/SARS-CoV-2.kmer.fa
  • The same error occurs if you also provide an empty fastq for --in2
  • The same error occurs if you provide uncompressed input files
  • I have been running this in an ubuntu docker container containing fastv. When I build the container using --platform linux/amd64, this error occurs, but when i build it with --platform linux/arm64/v8, the error does not occur.

The backtrace at the segfault (from gdb) is below:

#0  0x000055555541ecf5 in std::char_traits<char>::copy (__n=4, __s2=0x7fffffffd1d0 "-nan", __s1=<optimized out>) at /usr/include/c++/7/bits/char_traits.h:350
#1  std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_copy (__n=4, __s=0x7fffffffd1d0 "-nan", __d=<optimized out>)
    at /usr/include/c++/7/bits/basic_string.h:340
#2  std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_copy_chars (__k2=0x7fffffffd1d4 "", __k1=0x7fffffffd1d0 "-nan",
    __p=<optimized out>) at /usr/include/c++/7/bits/basic_string.h:382
#3  std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*> (__end=0x7fffffffd1d4 "", __beg=0x7fffffffd1d0 "-nan",
    this=0x7fffffffd4c0) at /usr/include/c++/7/bits/basic_string.tcc:225
#4  std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct_aux<char*> (__end=0x7fffffffd1d4 "",
    __beg=0x7fffffffd1d0 "-nan", this=0x7fffffffd4c0) at /usr/include/c++/7/bits/basic_string.h:236
#5  std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*> (__end=0x7fffffffd1d4 "", __beg=0x7fffffffd1d0 "-nan",
    this=0x7fffffffd4c0) at /usr/include/c++/7/bits/basic_string.h:255
#6  std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string<char*, void> (__a=..., __end=0x7fffffffd1d4 "",
    __beg=0x7fffffffd1d0 "-nan", this=0x7fffffffd4c0) at /usr/include/c++/7/bits/basic_string.h:607
#7  __gnu_cxx::__to_xstring<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char> (__convf=<optimized out>, __n=328,
    __fmt=0x5555554862c4 "%f", __fmt=0x5555554862c4 "%f", __n=328, __convf=<optimized out>) at /usr/include/c++/7/ext/string_conversions.h:115
#8  0x0000555555421124 in std:: (__val=<optimized out>) at /usr/include/c++/7/bits/basic_string.h:6462
#9  FilterResult::reportHtml (this=0x555556213f10, ofs=..., totalReads=<optimized out>, totalBases=0) at src/filterresult.cpp:319
#10 0x0000000000000000 in ?? ()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions