Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prefilter segfault #872

Merged

Conversation

leejoey0921
Copy link
Contributor

@leejoey0921 leejoey0921 commented Aug 13, 2024

Description

bugfix for a segmentation fault in mmseqs prefilter, which occured in the following circumstances:

  • seqLen of sequences larger than 32768 are overridden to 1 to lower their priority in diagonal score calculation
  • min(seqs[i].seqLen - minDistToDiagonal, minSeqLen); returns an underflowed value for low seqLen, which holds for the above case (UngappedAlignment L:279)

=> this invalid seqLength value causes unrolledDiagonalScoring(...) to access memory out of bounds, causing a seg fault

Changes

  • added a safety check to prevent seqLength having invalid(underflowed) values
  • seqLen larger than 32768 are overridden to 0 instead of 1, in order to completely skip the processing inside unrolledDiagonalScoring(...)

Other Details

  • error encountered when running mmseqs easy-cluster on uniparc DB
  • stack trace:
#0  UngappedAlignment::unrolledDiagonalScoring<21u> (...) 
    at MMseqs2/src/prefiltering/UngappedAlignment.cpp:58
#1  UngappedAlignment::scoreDiagonalAndUpdateHits (...) 
    at MMseqs2/src/prefiltering/UngappedAlignment.cpp:281
#2  UngappedAlignment::computeScores (...) 
    at /MMseqs2/src/prefiltering/UngappedAlignment.cpp:349
#3  UngappedAlignment::align (...)
    at /MMseqs2/src/prefiltering/UngappedAlignment.cpp:26
#4  QueryMatcher::match (...)
    at /MMseqs2/src/prefiltering/QueryMatcher.cpp:295
#5  QueryMatcher::matchQuery (...)
    at /MMseqs2/src/prefiltering/QueryMatcher.cpp:103
#6  Prefiltering::runSplit (...)
    at /MMseqs2/src/prefiltering/Prefiltering.cpp:843

@leejoey0921 leejoey0921 marked this pull request as draft August 13, 2024 06:23
@leejoey0921 leejoey0921 changed the title fix: seg fault in prefilter fix: prefilter segfault Aug 13, 2024
@leejoey0921 leejoey0921 marked this pull request as ready for review August 14, 2024 02:11
@martin-steinegger martin-steinegger merged commit 8ef39f4 into soedinglab:master Aug 16, 2024
15 checks passed
@martin-steinegger
Copy link
Member

Thank you so much for fixing this!

@leejoey0921 leejoey0921 deleted the fix/prefilter_segfault branch August 23, 2024 05:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants