Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-980

Numerical overflow in BurstFilter not handled correctly

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: 2.2
    • Fix Version/s: 2.3
    • Component/s: Filters
    • Labels:
      None

      Description

      org.apache.logging.log4j.core.filter.BurstFilter.LogDelay#compareTo is implemented with mistake - it does not account for numerical overflow (negative values). I.e. System.nanoTime() JavaDocs say:

      To compare two nanoTime values

      long t0 = System.nanoTime();
      ...
      long t1 = System.nanoTime();
      one should use t1 - t0 < 0, not t1 < t0, because of the possibility of numerical overflow.

      but the mentioned method compares values directly.

        Attachments

        1. LOG4J2-980.patch
          3 kB
          Mikhail Mazurskiy

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              ash2k Mikhail Mazurskiy
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: