[Geoserver-devel] [JIRA] (GEOS-9834) GetLegendGraphic results in java.lang.NegativeArraySizeException or OutOfMemory

Simon Hofer created an issue

GeoServer / BugGEOS-9834

GetLegendGraphic results in java.lang.NegativeArraySizeException or OutOfMemory

Issue Type:

BugBug

Affects Versions:

2.18.1, 2.19-RC

Assignee:

Unassigned

Components:

WMS

Created:

21/Dec/20 8:30 AM

Priority:

MediumMedium

Reporter:

Simon Hofer

When requesting the GetLegendGraphic of Grouplayers I saw java.lang.NegativeArraySizeException or OutOfMemory exceptions (only when setting dpi).

Digging down the rabbit hole I found that the org.geoserver.wms.legendgraphic.LegendGraphicBuilder.resizeForDPI is always scaling the image size (w and h) with the size from before. With my some number of layers this ends up with an image which is bigger then Integer.MAX_VALUE Bytes.

I assume that following would be better than using w/h again:

            w = ((int) Math.round(request.getWidth() * scaleFactor));
            h = ((int) Math.round(request.getHeight() * scaleFactor));

Add Comment

Add Comment

Get Jira notifications on your phone! Download the Jira Cloud app for Android or iOS


This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100153-sha1:55cb54c)

Atlassian logo