[Geoserver-devel] [JIRA] (GEOS-7230) gs:DownloadEstimator should check size is less than Integer.MAX_VALUE

Stefano Costa created an issue

GeoServer / BugGEOS-7230

gs:DownloadEstimator should check size is less than Integer.MAX_VALUE

Issue Type:

BugBug

Affects Versions:

2.8.0, 2.7.2, 2.9-beta

Assignee:

Stefano Costa

Components:

Community modules

Created:

06/Oct/15 12:44 PM

Priority:

MediumMedium

Reporter:

Stefano Costa

The gs:DownloadEstimator process only checks the requested size against the configured raster size limit, without worrying to check that it is also a valid Integer value.

If one raises the raster size limit above Integer.MAX_VALUE in the configuration and tries to download a huge image (e.g. 100,000 * 60,000), the estimator will say the request is ok, but the actual download will throw an exception:

org.geotools.process.ProcessException: java.lang.IllegalArgumentException: Dimensions (width=98899 height=60354) are too large
	at org.geoserver.wps.gs.download.DownloadProcess.execute(DownloadProcess.java:294)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.geotools.process.factory.AnnotationDrivenProcessFactory$InvokeMethodProcess.execute(AnnotationDrivenProcessFactory.java:549)
	at org.geoserver.wps.executor.DefaultProcessManager$ProcessCallable.call(DefaultProcessManager.java:201)
	at org.geoserver.wps.executor.DefaultProcessManager$ProcessCallable.call(DefaultProcessManager.java:169)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: Dimensions (width=XXX height=YYY) are too large
	at java.awt.image.SampleModel.<init>(SampleModel.java:130)
	at java.awt.image.MultiPixelPackedSampleModel.<init>(MultiPixelPackedSampleModel.java:147)
	at java.awt.image.MultiPixelPackedSampleModel.<init>(MultiPixelPackedSampleModel.java:107)
	at java.awt.image.Raster.createPackedRaster(Raster.java:846)
	at java.awt.image.Raster.createPackedRaster(Raster.java:588)
	at java.awt.image.BufferedImage.<init>(BufferedImage.java:450)
	at javax.media.jai.ROIShape.getAsImage(ROIShape.java:1129)
	at org.geotools.image.ImageWorker.mosaic(ImageWorker.java:4381)
	at org.geotools.coverage.processing.operation.Crop.buildResult(Crop.java:680)
	at org.geotools.coverage.processing.operation.Crop.doOperation(Crop.java:439)
	at org.geotools.coverage.processing.CoverageProcessor.doOperation(CoverageProcessor.java:605)
	at org.geotools.coverage.processing.CoverageProcessor.doOperation(CoverageProcessor.java:627)
	at org.geotools.process.raster.CropCoverage.execute(CropCoverage.java:81)
	at org.geoserver.wps.gs.download.RasterDownload.execute(RasterDownload.java:244)
	at org.geoserver.wps.gs.download.DownloadProcess.execute(DownloadProcess.java:204)
	... 11 more

The estimator should return false if the requested image size is above Integer.MAX_VALUE.

Add Comment

Add Comment

This message was sent by Atlassian JIRA (v7.0.0-OD-07-011#70107-sha1:db940e9)

Atlassian logo