Possible integer overflow in test_disagg_failover_perf.cpp

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Storage Engines - Persistence
    • None
    • None

      In test_disagg_failover_perf.cpp

      We have the line: 

      if (opt.warm_cache_pct > 0)
           cache_warming(opt.collection_count  ** opt.key_count  ** opt.warm_cache_pct / 100);
      To avoid overflow, we should cast to int64_t 

      Unintentional integer overflow

      The expression's value may not be what the programmer intended, because the expression is evaluated using a narrow (i.e. few bits) integer type. An integer overflow occurs, with the result converted to a wider integer type
      /test/cppsuite/tests/test_disagg_failover_perf.cpp:581: OVERFLOW_BEFORE_WIDEN 184231 Potentially overflowing expression "opt.collection_count * opt.key_count" with type "int" (32 bits, signed) is evaluated using 32-bit arithmetic, and then used in a context that expects an expression of type "int64_t" (64 bits, signed).

            Assignee:
            Unassigned
            Reporter:
            Coverity Collector User
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated: