Skip to content
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

Merged
merged 7 commits into from
Sep 1, 2014

Conversation

Echelon9
Copy link
Contributor

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(...), and table = 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.

  • Is it mergable?
  • Did it pass the tests?
  • If it introduces new functionality in scripts/ is it tested?
    Check for code coverage.
  • Is it well formatted? Look at make pep8, make diff_pylint_report,
    make cppcheck, and make doc output. Use make autopep8,
    astyle -A10 --max-code-length=80, and manual fixing as needed.
  • Is it documented in the Changelog?
  • Was spellcheck run on the source code and documentation after
    changes were made?

@ged-jenkins
Copy link

Can one of the admins verify this patch?

1 similar comment
@ged-jenkins
Copy link

Can one of the admins verify this patch?

@Echelon9
Copy link
Contributor Author

@mr-c ready for review!

@mr-c
Copy link
Contributor

mr-c commented Aug 28, 2014

okay to test

@Echelon9
Copy link
Contributor Author

@mr-c I don't think the Travis bot quite triggered on this PR

@mr-c
Copy link
Contributor

mr-c commented Aug 29, 2014

ok to test


if (strlen(s.c_str()) < counting->ksize()) {
PyErr_SetString(PyExc_ValueError,
"string length must >= the hashtable k-mer size");
Copy link
Contributor

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.

@Echelon9 Echelon9 force-pushed the fix/get-wrong_length_string branch from 2a67d76 to b6a19da Compare August 30, 2014 05:34
@Echelon9
Copy link
Contributor Author

Updated the PR with changes to those two user-visible output strings per review by @mr-c .
Ready to review.

@mr-c
Copy link
Contributor

mr-c commented Sep 1, 2014

Great work, @Echelon9. Thanks!

@mr-c mr-c closed this Sep 1, 2014
@mr-c mr-c reopened this Sep 1, 2014
@ged-jenkins
Copy link

Can one of the admins verify this patch?

1 similar comment
@ged-jenkins
Copy link

Can one of the admins verify this patch?

mr-c added a commit that referenced this pull request Sep 1, 2014
Fix table.get("wrong_length_string") gives core dump
@mr-c mr-c merged commit 1b79b7e into dib-lab:master Sep 1, 2014
@Echelon9 Echelon9 deleted the fix/get-wrong_length_string branch September 1, 2014 13:25
@mr-c mr-c modified the milestone: 1.2 Release Sep 2, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants