From: Anton Korobeynikov Date: Sat, 13 Oct 2012 21:39:24 +0000 (+0400) Subject: Make sure there is no signed int overflow X-Git-Tag: v0.22.0~1102 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=e5baaa965b0f902102da67cf5c6d28efeddd81ef;p=folly.git Make sure there is no signed int overflow Summary: use proper type for index. Test Plan: . Reviewed By: tudorb@fb.com FB internal diff: D660142 --- diff --git a/folly/small_vector.h b/folly/small_vector.h index cf9caa6e..45697b86 100644 --- a/folly/small_vector.h +++ b/folly/small_vector.h @@ -205,7 +205,7 @@ namespace detail { void populateMemForward(T* mem, std::size_t n, Function const& op) { std::size_t idx = 0; try { - for (int i = 0; i < n; ++i) { + for (size_t i = 0; i < n; ++i) { op(&mem[idx]); ++idx; }