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 coordinate range check for negative strands in mafNextWithPos #88

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added src/blat/blat
Binary file not shown.
24 changes: 19 additions & 5 deletions src/lib/maf.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,26 @@ for (;;)
textSize, ali->textSize, lf->lineIx, lf->fileName);
}

/* Do some sanity checking. */
/* Do some sanity checking. */
if (comp->srcSize < 0 || comp->size < 0)
errAbort("Got a negative size line %d of %s", lf->lineIx, lf->fileName);
if (comp->start < 0 || comp->start + comp->size > comp->srcSize)
errAbort("Coordinates out of range line %d of %s", lf->lineIx, lf->fileName);

errAbort("Got a negative size line %d of %s", lf->lineIx, lf->fileName);
if (comp->start < 0)
errAbort("Negative start position at line %d of %s", lf->lineIx, lf->fileName);
if (comp->strand == '+')
{
if (comp->start + comp->size > comp->srcSize)
errAbort("Coordinates out of range for positive strand at line %d of %s", lf->lineIx, lf->fileName);
}
else if (comp->strand == '-')
{
if (comp->start > comp->srcSize)
errAbort("Start coordinate out of range for negative strand at line %d of %s", lf->lineIx, lf->fileName);
}
else
{
errAbort("Invalid strand '%c' at line %d of %s", lf->lineIx, lf->fileName);
}

/* Add component to head of list. */
slAddHead(&ali->components, comp);
}
Expand Down