mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-07 10:34:08 +00:00
properly check format of viewbox parameter
This commit is contained in:
@@ -180,6 +180,16 @@ class Geocode
|
|||||||
{
|
{
|
||||||
$this->aViewBox = array_map('floatval', $aViewbox);
|
$this->aViewBox = array_map('floatval', $aViewbox);
|
||||||
|
|
||||||
|
if ($this->aViewBox[0] < -180
|
||||||
|
|| $this->aViewBox[2] > 180
|
||||||
|
|| $this->aViewBox[0] >= $this->aViewBox[2]
|
||||||
|
|| $this->aViewBox[1] < -90
|
||||||
|
|| $this->aViewBox[3] > 90
|
||||||
|
|| $this->aViewBox[1] >= $this->aViewBox[3]
|
||||||
|
) {
|
||||||
|
userError("Bad parameter 'viewbox'. Out of range".$this->aViewBox[0]."|".$this->aViewBox[1]."|".$this->aViewBox[2]."|".$this->aViewBox[3]);
|
||||||
|
}
|
||||||
|
|
||||||
$fHeight = $this->aViewBox[0] - $this->aViewBox[2];
|
$fHeight = $this->aViewBox[0] - $this->aViewBox[2];
|
||||||
$fWidth = $this->aViewBox[1] - $this->aViewBox[3];
|
$fWidth = $this->aViewBox[1] - $this->aViewBox[3];
|
||||||
$aBigViewBox[0] = $this->aViewBox[0] + $fHeight;
|
$aBigViewBox[0] = $this->aViewBox[0] + $fHeight;
|
||||||
@@ -258,10 +268,16 @@ class Geocode
|
|||||||
|
|
||||||
$aViewbox = $oParams->getStringList('viewboxlbrt');
|
$aViewbox = $oParams->getStringList('viewboxlbrt');
|
||||||
if ($aViewbox) {
|
if ($aViewbox) {
|
||||||
|
if (count($aViewbox) != 4) {
|
||||||
|
userError("Bad parmater 'viewbox'. Expected 4 coordinates.");
|
||||||
|
}
|
||||||
$this->setViewbox($aViewbox);
|
$this->setViewbox($aViewbox);
|
||||||
} else {
|
} else {
|
||||||
$aViewbox = $oParams->getStringList('viewbox');
|
$aViewbox = $oParams->getStringList('viewbox');
|
||||||
if ($aViewbox) {
|
if ($aViewbox) {
|
||||||
|
if (count($aViewbox) != 4) {
|
||||||
|
userError("Bad parmater 'viewbox'. Expected 4 coordinates.");
|
||||||
|
}
|
||||||
$this->setViewBox(array(
|
$this->setViewBox(array(
|
||||||
$aViewbox[0],
|
$aViewbox[0],
|
||||||
$aViewbox[3],
|
$aViewbox[3],
|
||||||
|
|||||||
Reference in New Issue
Block a user