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

Prevent crash when only FASTA entry has no sequence. #1507

Merged
merged 1 commit into from
Sep 15, 2022

Conversation

jkbonfield
Copy link
Contributor

Eg the minimal file of:

>foo

Credit to OSS-Fuzz
Fixes oss-fuzz 51378

Eg the minimal file of:

    >foo

Credit to OSS-Fuzz
Fixes oss-fuzz 51378
@jkbonfield jkbonfield changed the title Prevent crash when last FASTA entry has no sequence. Prevent crash when only FASTA entry has no sequence. Sep 15, 2022
@jkbonfield
Copy link
Contributor Author

jkbonfield commented Sep 15, 2022

Note I did also wonder about changing the (ret = ...) < -1 condition to < 0 so a blank sequence is an error, but technically we do support empty sequences in FASTA.

Adittedly this is specifically the case of the last sequence being empty (which then triggers a bug if it also happens to be the first so hts_getline hasn't yet allocated a buffer), but if we accept empty sequences in FASTA elsewhere then I guess we should accept them at the end too. Not sure if that's good or bad, but this fix is consistent in that behaviour at least.

@daviesrob daviesrob merged commit a1dec95 into samtools:develop Sep 15, 2022
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