commandParser.parserFile() Isn't Resizing words Buffer Properly Leading To Seg Fault
Closed this issue · 1 comments
When running a 9 token command from a text file, I get a segment fault. The same command can be run from the command line and an equivalent 8 token command can be run from both a text file and the command line.
For example this 8 token command can be run from a file -
write
test.wig
sum
FQ001_R1_S00000002.confirmedcounts.bw
FQ000_R1_S00000000.confirmedcounts.bw
FQ001_R1_S00000001.confirmedcounts.bw
FQ001_R1_S00000000.confirmedcounts.bw
FQ000_R1_S00000002.confirmedcounts.bw
While this 9 token command cannot -
write
test.wig
sum
FQ001_R1_S00000002.confirmedcounts.bw
FQ000_R1_S00000000.confirmedcounts.bw
FQ001_R1_S00000001.confirmedcounts.bw
FQ001_R1_S00000000.confirmedcounts.bw
FQ000_R1_S00000002.confirmedcounts.bw
FQ000_R1_S00000001.confirmedcounts.bw
In commandParser.c, I replaced - words = realloc(words, arrayLength * sizeof(char));
with words = realloc(words, arrayLength * sizeof(char *));
, recompiled and got a good file run with the 9 token command. I think that's the issue but if there's any misunderstanding, let me know.
Thanks for your work. I like the wiggletools syntax and based on small scale testing suspect it's going to offer a performance improvement over the toolset I'm currently using, particularly with respect to sort-free multi-file merge operations.
Hello @jgaupp-accuragen ,
Thanks a lot for the bug report, that was indeed a typo! I'm sending in a PR right now.
Cheers,
Daniel