vdb icon indicating copy to clipboard operation
vdb copied to clipboard

Current bufferSize too small causing out of array bounds access error

Open nsapoval opened this issue 2 years ago • 0 comments

When using vdb with the newest MSA from GISAID I got illegal hardware instruction error. After turning off the -O flag during the compilation I identified that this was an Swift/ContiguousArrayBuffer.swift:575: Fatal error: Index out of range error. Some quick bug hunt led me to the issue which occurred on this line: https://github.com/variant-database/vdb/blob/ab73f5ee8f161ce998fa83825326db133e80ee59/vdbCreate.swift#L379

The bufferSize is set to 50,000 (thus limiting the size of refBuffer array), while the refBufferPosition gets the value >57,000.

I fixed this in my local repo by changing the following line: https://github.com/variant-database/vdb/blob/ab73f5ee8f161ce998fa83825326db133e80ee59/vdbCreate.swift#L209

and setting the bufferSize to 100,000.

Please let me know if you would like me to create a PR to fix this or whether this will be addressed in the future version.

nsapoval avatar Oct 25 '22 00:10 nsapoval