Open ghost opened 5 years ago
Swapping the last two lines gets rid of the seg fault:
id[0] = aho_add_match_text(&aho, "consectetur", strlen("consectetur"));
id[1] = aho_add_match_text(&aho, "Proin", strlen("Proin"));
id[2] = aho_add_match_text(&aho, "egestasAliquam", strlen("egestasAliquam"));
id[3] = aho_add_match_text(&aho, "elementum", strlen("elementum"));
id[5] = aho_add_match_text(&aho, "vehicula", strlen("vehicula"));
id[4] = aho_add_match_text(&aho, "ultricies", strlen("ultricies"));
I was busy. so I don't check it now. But this month, check out it.
Thanks for your concern.
See pull request https://github.com/morenice/ahocorasick/pull/6. There is an edge case that causes a suffix link to be null; this in turn causes the segfault when looking for matches.
These lines cause the segmentation fault