From a08cdd721a9b1ba3d7371a2625517fa3a90eaf9b Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Sat, 27 Jun 2020 07:58:46 -0400 Subject: [PATCH] Fix edge case involving filter with a single wildcard This fix the case of the following filter: trk*.vidible.tv Not matching: https://trk.vidible.tv/trk/.vidible.tv The wildcard is supposed to match any number of characters, including zero characters. The issue is that the code was not matching zero characters. This is due to an incorrect comparison in BidiTrieContainer.indexOf(), causing the code to bail out before testing for the zero character condition. --- src/js/strie.js | 2 +- src/js/wasm/biditrie.wasm | Bin 990 -> 990 bytes src/js/wasm/biditrie.wat | 4 ++-- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/js/strie.js b/src/js/strie.js index b9b94df22..6a3096fa3 100644 --- a/src/js/strie.js +++ b/src/js/strie.js @@ -658,7 +658,7 @@ const roundToPageSize = v => (v + PAGE_SIZE-1) & ~(PAGE_SIZE-1); i += 1; } haystackLeft += 1; - if ( haystackLeft === haystackEnd ) { break; } + if ( haystackLeft > haystackEnd ) { break; } } return -1; } diff --git a/src/js/wasm/biditrie.wasm b/src/js/wasm/biditrie.wasm index e1de9312c791266c644351b10c0a287b8ea10b37..5bfc6b7d0480ef5fefe921bcb3f7b4afd571e778 100644 GIT binary patch delta 13 Ucmcb|evf@a1T&-e haystackEnd ) { break; } get_local $haystackEnd - i32.eq + i32.gt_u br_if $fail br $mainLoop ;; }