-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
It took me a while to track down why it was seg faulting, but a look at the code makes it clear:
337 FILE * Hash_file = fopen(path, "r");
338 FILE * fasta_input = fopen(argv[argc-2], "r");
339 if (!fasta_input) {
340 puts("Input open fail");
341 }
342 strcpy(path, argv[argc-1]);
343 strcat(path, ".bin");
344 FILE * OutFile = fopen(path, "w");
345 fseek(Hash_file, 4, 0);
So if "path" doesn't exist, Hash_file is a null pointer and fseek(Hash_file, 4, 0 ) will seg fault.
It would be helpful to users if you checked to see if Hash_file is null and gave an informative error message.
Metadata
Metadata
Assignees
Labels
No labels