The following issues were found

test/cpp/tensorexpr/test_registerizer.cpp
1 issues
syntax error
Error

Line: 15

              using namespace torch::jit::tensorexpr;

// Can replace a simple scalar access with a local variable.
TEST(Registerizer, RegisterizerSimple) {
  KernelScope kernel_scope;
  BufHandle a("A", {1}, kInt);
  VarHandle x("x", kInt);
  StmtPtr stmt = Block::make(
      {Store::make(a, {0}, 0),

            

Reported by Cppcheck.

caffe2/serialize/inline_container.h
1 issues
read - Check buffer boundaries if used in a loop including recursive loops
Security

Line: 115 Column: 10 CWE codes: 120 20

              
 private:
  void init();
  size_t read(uint64_t pos, char* buf, size_t n);
  void valid(const char* what, const char* info = "");
  size_t getRecordID(const std::string& name);

  friend size_t
  istream_read_func(void* pOpaque, uint64_t file_ofs, void* pBuf, size_t n);

            

Reported by FlawFinder.

test/cpp/tensorexpr/test_reductions.cpp
1 issues
syntax error
Error

Line: 26

              
using namespace torch::jit::tensorexpr;

TEST(Reductions, ReduceSum0D_1) {
  KernelScope kernel_scope;
  const int M = 10;

  Placeholder b(BufHandle("b", {M}, kFloat));
  std::vector<float> in(M);

            

Reported by Cppcheck.

test/cpp/tensorexpr/test_memdependency.cpp
1 issues
syntax error
Error

Line: 21

              // overlap. No Overlap & partial overlap is obvious. Contains means A is
// larger and fully encloses B, while ContainedOrEqual is the reverse. Equal
// ranges are ContainedOrEqual.
TEST(MemDependency, BoundOverlap) {
  KernelScope kernel_scope;

  using namespace analysis;

  auto CB = [](int s, int e) {

            

Reported by Cppcheck.

test/cpp/tensorexpr/test_loopnest.cpp
1 issues
syntax error
Error

Line: 32

                torch::jit::testing::FileCheck().run(pattern, oss.str());
}

TEST(LoopNest, ExprSimple01) {
  KernelScope kernel_scope;
  Tensor* tensor = Compute(
      "f", {{16, "X"}, {5, "y"}}, [](const VarHandle& x, const VarHandle& y) {
        return ExprHandle(1.0f) + cast<float>(x) * x + cast<float>(y) * y;
      });

            

Reported by Cppcheck.

test/cpp/tensorexpr/test_llvm.cpp
1 issues
syntax error
Error

Line: 48

                    ASSERT_EQ(cg.value<Type>(), Val);            \
    }                                              \
  }
TEST_LLVM_SCALAR_TYPES(IMM_TEST)
#undef IMM_TEST

#define ADD_TEST(Type, Name, Val)                  \
  TEST(LLVM, Name##AddTest) {                      \
    KernelScope kernel_scope;                      \

            

Reported by Cppcheck.

test/cpp/tensorexpr/test_kernel.cpp
1 issues
syntax error
Error

Line: 31

                }
};

TEST_F(Kernel, InliningIntermediates) {
  // here, each mul has only one use, so it should be completely inlined
  {
    const auto graph_string = R"IR(
        graph(%0 : Float(5, 3, strides=[3, 1], device=cpu),
              %1 : Float(5, 3, strides=[3, 1], device=cpu)):

            

Reported by Cppcheck.

caffe2/serialize/file_adapter.h
1 issues
read - Check buffer boundaries if used in a loop including recursive loops
Security

Line: 18 Column: 10 CWE codes: 120 20

                C10_DISABLE_COPY_AND_ASSIGN(FileAdapter);
  explicit FileAdapter(const std::string& file_name);
  size_t size() const override;
  size_t read(uint64_t pos, void* buf, size_t n, const char* what = "")
      const override;
  ~FileAdapter() override;

 private:
  // An RAII Wrapper for a FILE pointer. Closes on destruction.

            

Reported by FlawFinder.

test/cpp/tensorexpr/test_ir_verifier.cpp
1 issues
syntax error
Error

Line: 19

              
using namespace torch::jit::tensorexpr;

TEST(IRVerifier, BitwiseOps) {
  KernelScope kernel_scope;
  VarPtr X = alloc<Var>("x", kInt);
  VarPtr Y = alloc<Var>("y", kFloat);
  {
    auto a = alloc<And>(X, Y);

            

Reported by Cppcheck.

test/cpp/tensorexpr/test_ir_printer.cpp
1 issues
syntax error
Error

Line: 19

              
using namespace torch::jit::tensorexpr;

TEST(IRPrinter, BasicValueTest) {
  KernelScope kernel_scope;
  ExprHandle a = IntImm::make(2), b = IntImm::make(3);
  ExprHandle c = Add::make(a, b);

  std::stringstream ss;

            

Reported by Cppcheck.