-
Notifications
You must be signed in to change notification settings - Fork 295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix table.get("wrong_length_string") gives core dump #585
Conversation
Can one of the admins verify this patch? |
1 similar comment
Can one of the admins verify this patch? |
@mr-c ready for review! |
okay to test |
@mr-c I don't think the Travis bot quite triggered on this PR |
ok to test |
|
||
if (strlen(s.c_str()) < counting->ksize()) { | ||
PyErr_SetString(PyExc_ValueError, | ||
"string length must >= the hashtable k-mer size"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't use the word "hash" in front of users as it is an implementation detail. Yes, the Python API is going to get a lot of methods renamed :-)
Use "counting table" here instead.
…tent with other negative tests
2a67d76
to
b6a19da
Compare
Updated the PR with changes to those two user-visible output strings per review by @mr-c . |
Great work, @Echelon9. Thanks! |
Can one of the admins verify this patch? |
1 similar comment
Can one of the admins verify this patch? |
Fix table.get("wrong_length_string") gives core dump
A number of
table.get("wrong_length_string")
functions when called from Python would lead to an unhandled C++ exception, and a subsequent termination (Issue #174).Note: These reported paths to trigger the core dump included
table = khmer.new_hashbits(...)
,table = khmer.new_hashtable(...)
, andtable = khmer.new_counting_hash(...)
Test Driven Development techniques were adopted in resolving this issue. Failing unit tests were written first based upon the user report, and then proposed patches committed until all the tests passed.
This methodology assisted in finding a second location in
khmer\_khmermodule.cc
that required the same fix. This was not immediately apparent upon first review of the C++ code.Testing the reproduction steps with gdb debugger and valgrind confirm the core dump is mitigated.
Check for code coverage.
make pep8
,make diff_pylint_report
,make cppcheck
, andmake doc
output. Usemake autopep8
,astyle -A10 --max-code-length=80
, and manual fixing as needed.changes were made?