Skip to content

Commit

Permalink
fix undefined behaviour null offset sum
Browse files Browse the repository at this point in the history
  • Loading branch information
horta committed Oct 9, 2023
1 parent 979e49f commit 6d05364
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion hmmer-reader/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.20.2 FATAL_ERROR)
project(
hmmer_reader
VERSION 0.7.2
VERSION 0.7.3
LANGUAGES C)
set(PROJECT_DESCRIPTION "HMMER ASCII file reader.")

Expand Down
4 changes: 2 additions & 2 deletions hmmer-reader/src/fsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ static int header(struct args *a)
assert(a->tok->id == HMR_TOK_WORD || a->tok->id == HMR_TOK_NL);
if (a->tok->id == HMR_TOK_WORD)
{
if (a->aux->prof.pos > a->aux->prof.begin + 1)
if (a->aux->prof.pos && (a->aux->prof.pos > a->aux->prof.begin + 1))
{
*(a->aux->prof.pos - 1) = ' ';
a->aux->prof.pos++;
Expand Down Expand Up @@ -310,7 +310,7 @@ static int field_content(struct args *a)
if (a->tok->id == HMR_TOK_WORD || a->tok->id == HMR_TOK_HMM ||
a->tok->id == HMR_TOK_COMPO)
{
if (a->aux->prof.pos > a->aux->prof.begin + 1)
if (a->aux->prof.pos && (a->aux->prof.pos > a->aux->prof.begin + 1))
{
*(a->aux->prof.pos - 1) = ' ';
a->aux->prof.pos++;
Expand Down

0 comments on commit 6d05364

Please sign in to comment.