Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8235904

Infinite loop when rendering huge lines

    XMLWordPrintable

Details

    • 2d
    • b07

    Backports

      Description

        There is a problem when rendering huge lines with the XRender pipeline, causing an infinite loop.

        The Bresenham renderer in sun/java2d/xr/XRDrawLine.java overflows when calculating the clip coordinates, for example the following code (line 283):

        xsteps = 2 * ysteps * ax + ay

        Produces the following with the attached test case already during the first passage:

        2 * 33535 * 34005 + 34005 = 2280749355

        The issue seems to also be present when using the native Bresenham renderer, although I hadn't found a way to exploit this yet.

        There is an old related bug describing the same issue but was marked as fixed, so this may be a regression, however the bug does not seem to have a commit in the OpenJDK code base so maybe it was fixed in the closed version only:

        https://bugs.openjdk.java.net/browse/JDK-4376103

        I can reproduce this problem on all the version I tried so far: 8u, 11u, 13 and latest-dev.

        Attachments

          Issue Links

            Activity

              People

                prr Philip Race
                neugens Mario Torre
                Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: