-
Notifications
You must be signed in to change notification settings - Fork 88
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
trie.items(), trie.keys() len(trie) et al. may be pending while trie is empty #17
Comments
Same bug here. Calling Here's
Update: turns out there's an unbounded loop in |
I'm not 100% sure this is correct, but it seems like diff --git a/libdatrie/datrie/darray.c b/libdatrie/datrie/darray.c
index c07712a..ea57ff3 100644
--- a/libdatrie/datrie/darray.c
+++ b/libdatrie/datrie/darray.c
@@ -774,7 +774,7 @@ da_first_separate (DArray *d, TrieIndex root, TrieString *keybuff)
break;
}
- if (c == max_c)
+ if (max_c == 0 || c == max_c)
return TRIE_INDEX_ERROR;
trie_string_append_char (keybuff, c); I can submit a PR if you're okay with the "solution". Why is da_get_check (d, base + c) == root
// => da_get_check(d, base) == root
// => 0 == 2 (see da_get_root() for the 2) |
Hi @superbobry, I think it is better to change the upstream code (http://linux.thai.net/~thep/datrie/datrie.html) if there is a bug. |
Yup, submitting the bug to the |
Yes, I've emailed him in past; we discussed some libdatrie changes needed for this wrapper and he made them in an original repo. A couple of bugs was also fixed this way. There is SVN repo: http://linux.thai.net/svn/software/datrie/?q=svn/software/datrie - it seems our copy is a bit outdated. There is also one incompatibility between SVN version and our version - here we have one extra method (dbe366b). In past I've just made sure it is kept when libdatrie is updated. |
The bug has been fixed in the SVN version. Should we wait for the next release or pull the SVN version into the repo instead? |
👍 we should pull the SVN version. |
hopefully this will help us avoid things like #17
* tests/Makefile.am, +tests/test_null_trie.c: - Add test case for empty trie iteration. * datrie/darray.c (da_first_separate): - Fix error condition after loop ending. Thanks Sergei Lebedev <sergei.a.lebedev@gmail.com> for the report via personal mail. Original report: pytries/datrie#17
* tests/Makefile.am, +tests/test_null_trie.c: - Add test case for empty trie iteration. * datrie/darray.c (da_first_separate): - Fix error condition after loop ending. Thanks Sergei Lebedev <sergei.a.lebedev@gmail.com> for the report via personal mail. Original report: pytries/datrie#17 git-svn-id: http://linux.thai.net/svn/software/datrie@267 1ef183b1-9dc7-4fb3-affb-44359c0196fe
* tests/Makefile.am, +tests/test_null_trie.c: - Add test case for empty trie iteration. * datrie/darray.c (da_first_separate): - Fix error condition after loop ending. Thanks Sergei Lebedev <sergei.a.lebedev@gmail.com> for the report via personal mail. Original report: pytries/datrie#17 git-svn-id: http://linux.thai.net/svn/software/datrie/trunk@267 1ef183b1-9dc7-4fb3-affb-44359c0196fe
* tests/Makefile.am, +tests/test_null_trie.c: - Add test case for empty trie iteration. * datrie/darray.c (da_first_separate): - Fix error condition after loop ending. Thanks Sergei Lebedev <sergei.a.lebedev@gmail.com> for the report via personal mail. Original report: pytries/datrie#17
* tests/Makefile.am, +tests/test_null_trie.c: - Add test case for empty trie iteration. * datrie/darray.c (da_first_separate): - Fix error condition after loop ending. Thanks Sergei Lebedev <sergei.a.lebedev@gmail.com> for the report via personal mail. Original report: pytries/datrie#17 git-svn-id: https://linux.thai.net/svn/software/datrie/trunk@267 1ef183b1-9dc7-4fb3-affb-44359c0196fe
There is no notice while pending. And even may cause Segment Fault.
The text was updated successfully, but these errors were encountered: