mem_bucket_by_size() has a big bug

XMLWordPrintable

    • Type: Problem report
    • Resolution: Won't fix
    • Priority: Blocker
    • None
    • Affects Version/s: 3.0.27, 4.0.7, 4.2.1
    • Component/s: Proxy (P), Server (S)
    • None

      src/libs/zbxmemory/memalloc.c : mem_bucket_by_size() code is following

      static int mem_bucket_by_size(zbx_uint64_t size)

      { if (size < MEM_MIN_BUCKET_SIZE) return 0; if (size < MEM_MAX_BUCKET_SIZE) return (size - MEM_MIN_BUCKET_SIZE) >> 3; return MEM_BUCKET_COUNT - 1; }

      It must be following, especially size over MEM_MAX_BUCKET_SIZE is critical bug.

      static int mem_bucket_by_size(zbx_uint64_t size)

      { if (MEM_MIN_BUCKET_SIZE > size) return 0; if (MEM_MAX_BUCKET_SIZE < size) return (size - MEM_MIN_BUCKET_SIZE) >> 3; return MEM_BUCKET_COUNT - 1; }

            Assignee:
            Zabbix Development Team
            Reporter:
            MATSUDA Daiki
            Team C
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: