GWC direct integration gets fooled by non cacheable requests and returns tiles

Description

The two following requests:

http://localhost:8080/geoserver/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&FORMAT=image%2Fpng&TRANSPARENT=true&tiled=true&STYLES&LAYERS=importer%3ASENTINEL1-footprints&tilesOrigin=-180%2C-90&WIDTH=256&HEIGHT=256&SRS=EPSG%3A4326&BBOX=0%2C-180%2C180%2C0

http://localhost:8080/geoserver/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&FORMAT=image%2Fpng&TRANSPARENT=true&tiled=true&STYLES&LAYERS=importer%3ASENTINEL1-footprints&tilesOrigin=-180%2C-90&WIDTH=256&HEIGHT=256&SRS=EPSG%3A4326&BBOX=0%2C0%2C180%2C180

Are clearly not cachable on the EPSG:4326 gridset and they span outside of the gridset bounds (the longitude goes down to -180 and up to 180) and yet GWC is not throwing any mis-alignment exception.

This is happening because in GridSet.getClosestIndex does not use Math.abs, so if the difference between x and posX, y and posY is negative, the check does not trigger (in the -180 example, the difference on the y axis is -0.5)

Environment

None

Status

Assignee

Andrea Aime

Reporter

Andrea Aime

Triage

None

Fix versions

Affects versions

None

Components

Priority

Medium
Configure