EddyRivasLab / easel

Sequence analysis library used by Eddy/Rivas lab code
Other
46 stars 26 forks source link

Fix unitialized `abc` pointer in `ESL_SQ` struct #55

Closed althonos closed 3 years ago

althonos commented 3 years ago

Hi!

This PR fixes an uninitialized pointer in the ESL_SQ struct initializer. Since the sq->abc was not set to NULL here, there was a risk that this field would contain garbage later on. I discovered this when calling esl_sq_Compare on two sequences in text mode: I would get a segmentation fault since the abc pointer would not be NULL (because of some garbage in the allocated memory) and it would then try to compare the alphabets, interpreting the garbage as pointers.

A bit of context (and a shameless plug): I discovered this while writing pyhmmer, a Cython extension module that provides Python bindings to HMMER and Easel (it's on GitHub and on PyPI).

cryptogenomicon commented 3 years ago

Thanks!

(I changed the base branch to our develop branch, since we use master for versioned releases.)