pytorch/caffe2/utils
frdong 92770d25cd fix comparison of narrow type with wide type in loop condition (#53951)
Summary:
fix Semmle warning: Comparison of narrow type with wide type in loop condition

For example there is below piece of code:
for (int i=0; i<array.size(); ++i) {}

The problem is that array.size() return type is size_t can be larger type than int depending on the implementation so there is chance that i overflows (for very large array that array size is beyond the range of integer) and this loop will never be terminated.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/53951

Reviewed By: zou3519

Differential Revision: D27181495

Pulled By: malfet

fbshipit-source-id: 0612c5cedcdc656c193085e7fbb87dd163f20688
2021-03-22 16:40:35 -07:00
..
hip
math Use sum_integers and multiply_integers (#51146) 2021-02-10 18:05:45 -08:00
threadpool Add guard to run on current thread (#52361) 2021-03-03 11:43:40 -08:00
bench_utils.cc
bench_utils.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
cast.h
cast_test.cc
cblas.h
CMakeLists.txt Add guard to run on current thread (#52361) 2021-03-03 11:43:40 -08:00
conversions.h [caffe2] use Clang identification macro in various places (#33574) 2020-02-20 15:16:11 -08:00
cpu_neon.h
cpuid.cc Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
cpuid.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
cpuid_test.cc
eigen_utils.h fix comparison of narrow type with wide type in loop condition (#53951) 2021-03-22 16:40:35 -07:00
fatal_signal_asan_no_sig_test.cc
filler.h
fixed_divisor.h [caffe2] use Clang identification macro in various places (#33574) 2020-02-20 15:16:11 -08:00
fixed_divisor_test.cc
GpuBitonicSort.cuh
GpuDefs.cuh CUDA RTX30 series support (#45489) 2020-09-29 18:19:23 -07:00
GpuScanUtils.cuh RIP CUDA <9.2: circleci, aten, and caffe2 (#36846) 2020-05-18 13:41:05 -07:00
map_utils.h Fix typos, via a Levenshtein-type corrector (#31523) 2020-01-17 16:03:19 -08:00
math-detail.h
math.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
math_cpu.cc caffe2: use at::mt19937 instead of std::mt19937 (10x speedup) (#43987) 2020-10-16 16:08:35 -07:00
math_gpu.cu add and adjust kernel launch checks under fbcode/caffe2/caffe2/utils (#50862) 2021-01-21 15:20:55 -08:00
math_gpu_test.cc
math_test.cc fix comparison of narrow type with wide type in loop condition (#53951) 2021-03-22 16:40:35 -07:00
murmur_hash3.cc
murmur_hash3.h
proto_convert.cc
proto_convert.h
proto_utils.cc [PyTorch] Narrow Device to 2 bytes by narrowing DeviceType and DeviceIndex (#47023) 2020-11-18 19:39:40 -08:00
proto_utils.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
proto_utils_test.cc
proto_wrap.cc Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
proto_wrap.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
signal_handler.cc preprocessor cleanup (#33957) 2020-03-02 13:37:19 -08:00
signal_handler.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
simple_queue.h
simple_queue_test.cc
smart_tensor_printer.cc preprocessor cleanup (#33957) 2020-03-02 13:37:19 -08:00
smart_tensor_printer.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
smart_tensor_printer_test.cc
string_utils.cc
string_utils.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
zmq_helper.h Fix typos, via a Levenshtein-type corrector (#31523) 2020-01-17 16:03:19 -08:00