Skip to content

Commit

Permalink
Fix segfault when OT fragment is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
kovzol committed Jan 1, 2025
1 parent 748a88f commit d871aaf
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions statements/pbrst.y
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ void add_parseinfo(char *s, ...) {
#define MAX_PARSEINFO_LINE_LENGTH 16384
char *line = malloc(MAX_PARSEINFO_LINE_LENGTH);
vsprintf(line, s, ap); // create line
// printf("%s", line); // print line
char *p1 = mystrcat(parseinfo, line); // store line
free(parseinfo);
parseinfo = p1;
Expand Down Expand Up @@ -777,6 +778,12 @@ void check_cover(double cover) {
}
}
}
if (oimin == INT_MAX) {
add_parseinfo(" none\n");
add_parseinfo("%d,%d: error: OT headline %d %s %s has no corresponding fragments\n", yylineno, yycolumn,
i, books_s[i], infos_s[i]);
return; // avoid segfault later
}
add_parseinfo(", union: [%d,%d]\n", oimin, oimax);
// Compare headline interval with the union:
int ot_headline_start = intervals[i][0];
Expand Down

0 comments on commit d871aaf

Please sign in to comment.