pytorch/caffe2/core
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
nomnigraph use make_shared and make_unique and clean unneeded code (#51829) 2021-02-10 21:38:43 -08:00
__init__.py
allocator.cc
allocator.h
blob.h
blob_gpu_test.cc
blob_serialization.cc fix comparison of narrow type with wide type in loop condition (#53951) 2021-03-22 16:40:35 -07:00
blob_serialization.h [caffe2] add a SerializationOptions field for the save operator (#53402) 2021-03-11 13:02:58 -08:00
blob_serialization_gpu.cc
blob_serializer_base.h [caffe2] add a SerializationOptions field for the save operator (#53402) 2021-03-11 13:02:58 -08:00
blob_stats.cc
blob_stats.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
blob_test.cc [caffe2] add a SerializationOptions field for the save operator (#53402) 2021-03-11 13:02:58 -08:00
CMakeLists.txt
common.cc
common.h [caffe2] add a CAFFE2_NODISCARD macro to help support old compilers (#53754) 2021-03-12 11:32:30 -08:00
common_cudnn.cc
common_cudnn.h
common_gpu.cc
common_gpu.h Introducing TORCH_CUDA_CPP_API and TORCH_CUDA_CU_API to the code (#50627) 2021-01-21 19:09:11 -08:00
common_omp.h
common_test.cc Forbid trailing whitespace (#53406) 2021-03-05 17:22:55 -08:00
context.cc
context.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
context_base.cc
context_base.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
context_gpu.cu use device methods (#52899) 2021-03-02 20:14:23 -08:00
context_gpu.h pass TypeMeta by value (#45026) 2020-10-30 10:14:17 -07:00
context_gpu_test.cc
context_test.cc
cudnn_wrappers.h
db.cc
db.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
distributions_stubs.h caffe2: use at::mt19937 instead of std::mt19937 (10x speedup) (#43987) 2020-10-16 16:08:35 -07:00
event.cc Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
event.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
event_cpu.h
event_gpu.cc
event_gpu_test.cc
event_test.cc
export_c10_op_to_caffe2.cc
export_c10_op_to_caffe2.h
export_caffe2_op_to_c10.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
flags.h
graph.cc
graph.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
graph_test.cc
init.cc
init.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
init_denormals.cc
init_intrinsics_check.cc
init_omp.cc
init_test.cc
int8_serialization.cc
logging.h
macros.h
macros.h.in Move USE_NUMPY to more appropriate targets (#51143) 2021-01-27 15:44:12 -08:00
memonger.cc [caffe][memonger] Extend operator schema check to dag memonger (#48021) 2020-11-16 19:17:55 -08:00
memonger.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
module.cc
module.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
module_test.cc
net.cc
net.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
net_async_base.cc
net_async_base.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
net_async_scheduling.cc
net_async_scheduling.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
net_async_task.cc
net_async_task.h
net_async_task_future.cc
net_async_task_future.h
net_async_task_graph.cc
net_async_task_graph.h
net_async_tracing.cc
net_async_tracing.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
net_async_tracing_test.cc
net_dag_utils.cc
net_dag_utils.h
net_dag_utils_test.cc
net_gpu_test.cc
net_parallel.cc
net_parallel.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
net_simple.cc [Caffe2] Implement BlackBoxPredictor::BenchmarkIndividualOps (#52903) 2021-02-27 19:49:22 -08:00
net_simple.h [Caffe2] Implement BlackBoxPredictor::BenchmarkIndividualOps (#52903) 2021-02-27 19:49:22 -08:00
net_simple_refcount.cc
net_simple_refcount.h
net_simple_refcount_test.cc
net_test.cc
numa.cc
numa.h
observer.h
observer_test.cc
operator.cc
operator.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
operator_gpu_test.cc
operator_gradient.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
operator_schema.cc fix comparison of narrow type with wide type in loop condition (#53951) 2021-03-22 16:40:35 -07:00
operator_schema.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
operator_schema_test.cc
operator_test.cc
parallel_net_test.cc
plan_executor.cc pass TypeMeta by value (#45026) 2020-10-30 10:14:17 -07:00
plan_executor.h
plan_executor_test.cc [caffe2] plan_executor_test: add test case for should_stop loops (#47613) 2020-11-16 12:59:13 -08:00
prof_dag_counters.cc fix comparison of narrow type with wide type in loop condition (#53951) 2021-03-22 16:40:35 -07:00
prof_dag_counters.h
qtensor.cc
qtensor.h Use sum_integers and multiply_integers (#51146) 2021-02-10 18:05:45 -08:00
qtensor_serialization.cc
qtensor_serialization.h
scope_guard.h
serialization_test.cc [caffe2] fix deserialization of unknown tensor data_type values (#52411) 2021-02-17 19:13:43 -08:00
static_tracepoint.h
static_tracepoint_elfx86.h
stats.cc use make_shared and make_unique and clean unneeded code (#51829) 2021-02-10 21:38:43 -08:00
stats.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
stats_test.cc
storage.h
tensor.cc Removing non-thread-safe log statement from ReinitializeTensor (#48185) 2020-11-18 17:42:22 -08:00
tensor.h [caffe2] Don't call TensorImpl::size() in dim32() (#53852) 2021-03-12 16:22:29 -08:00
tensor_impl.h
tensor_int8.cc
tensor_int8.h
test_utils.cc
test_utils.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
timer.h
timer_test.cc raise windows tol to 30% (#51733) 2021-02-04 14:09:10 -08:00
transform.cc
transform.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
transform_test.cc
types.cc pass TypeMeta by value (#45026) 2020-10-30 10:14:17 -07:00
types.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
workspace.cc [caffe2] Avoid some double (and triple) lookups in workspace (#53319) 2021-03-04 22:57:02 -08:00
workspace.h [caffe2] Avoid some double (and triple) lookups in workspace (#53319) 2021-03-04 22:57:02 -08:00
workspace_test.cc