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

Better error handling for model files loading #24

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

kmike
Copy link
Contributor

@kmike kmike commented Apr 26, 2014

There are two improvements in this PR:

  • fixed memory access past allocated size;
  • function returns early if the model file doesn't start with FILEMAGIC, to prevent incorrect interpretation of data.

kmike added 2 commits April 27, 2014 00:15
* fix memory access past allocated size;
* return early if the model file doesn't start with FILEMAGIC
  (to prevent incorrect interpretation of data).
@kmike
Copy link
Contributor Author

kmike commented Apr 26, 2014

There are similar issues in crf1dm_get_labelref, crf1dm_get_attrref and crf1dm_get_feature functions; I haven't fixed them here.

chokkan pushed a commit that referenced this pull request Jan 24, 2016
+ Partially incorporated Pull Request #24.
@kmike
Copy link
Contributor Author

kmike commented Jan 27, 2016

Thanks for looking into it! Some context: these fixes were to fix segfaults I found writing tests for https://github.com/tpeng/python-crfsuite. Some of issues are worked around in a python-crfsuite wrapper (e.g. here), but it is still possible to cause a segfault (e.g. see these tests).

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.

1 participant