You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following test case seems to fail -- specifically, the invocation of has_trailing? seems to incorrectly report false:
s = Mongrel::BMHSearch.new('--X', 512)
s.find('--X') # No trailing
s.find('B--') # Trailing; works correctly
s.find('X--') # Trailing
raise 'fail' unless (s.has_trailing?) # Fails
The correctness of s.has_trailing? makes buffer management in the caller much simpler and/or more efficient in some cases.
Commenting out the following line in ext/bmh_search/bmh_search.c (around line 199) and ending brace:
// don't bother if the string ends in the needle completely
if(S->nfound == 0 || last != hlen - S->nlen) {
...
}
...seems to fix the problem for this test case, and all of the ones in the application I'm currently working on. I haven't had a chance to run the fuzzers/tests that come up on pastie.org yet, but I plan to.
Dave
(who is writing stream-based multipart mime handling code, and happened to run in to this...)
The text was updated successfully, but these errors were encountered:
The following test case seems to fail -- specifically, the invocation of has_trailing? seems to incorrectly report false:
s = Mongrel::BMHSearch.new('--X', 512)
s.find('--X') # No trailing
s.find('B--') # Trailing; works correctly
s.find('X--') # Trailing
raise 'fail' unless (s.has_trailing?) # Fails
The correctness of s.has_trailing? makes buffer management in the caller much simpler and/or more efficient in some cases.
Commenting out the following line in ext/bmh_search/bmh_search.c (around line 199) and ending brace:
// don't bother if the string ends in the needle completely
if(S->nfound == 0 || last != hlen - S->nlen) {
...
}
...seems to fix the problem for this test case, and all of the ones in the application I'm currently working on. I haven't had a chance to run the fuzzers/tests that come up on pastie.org yet, but I plan to.
Dave
(who is writing stream-based multipart mime handling code, and happened to run in to this...)
The text was updated successfully, but these errors were encountered: