Closed leewis101 closed 4 years ago
Thanks for reporting.
The freq in the default dictionary is
测试 2444 vn
threrefore it would result overflow because freq
is 10
and old_freq
is 2444
self.total += freq - old_freq;
I would create a PR to break it into two ops (subtraction then addition) to avoid overflow.
Fixed in master.
thread 'main' panicked at 'attempt to subtract with overflow', ~/.cargo/registry/src/github.com-1ecc6299db9ec823/jieba-rs-0.4.10/src/lib.rs:254:31