[libcxx-commits] [PATCH] D121074: [libc++] Implement std::boyer_moore{, _horspool}_searcher

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed May 11 09:35:05 PDT 2022


ldionne requested changes to this revision.
ldionne added inline comments.
This revision now requires changes to proceed.


================
Comment at: libcxx/include/__functional/boyer_moore_searcher.h:208
+
+    vector<value_type> __scratch(__count);
+
----------------
adamdebreceni wrote:
> philnik wrote:
> > adamdebreceni wrote:
> > > shouldn't this be `vector<difference_type>`?
> > Why do you think it should be `vector<difference_type>`?
> if `value_type` is `signed` and the range consists of e.g. the same values with length more than the max, `__compute_bm_prefix` will cause a signed overflow, moreover as `__scratch` can now contain negative values we could index out of `__suffix_`
We should add a test and fix this bug in both this version and the `experimental/functional` version as well (even though we'll eventually remove that one).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121074/new/

https://reviews.llvm.org/D121074



More information about the libcxx-commits mailing list