Use is_numeric instead of ctype_digit for 'poly' validation

Duplicates the logic from tokenizeCoords which is used by
'rect' & 'circle'.

Bug: T217087
Change-Id: I7c59bb9ea410bae8800922356829bca669d2e69c
This commit is contained in:
Ed Sanders 2019-03-30 19:46:27 +00:00
parent 70a6b723c7
commit fb20685b48

View file

@ -207,8 +207,7 @@ class ImageMap {
$coords = [];
$coord = strtok( " \t" );
while ( $coord !== false ) {
// T217087: protect against non-numeric values with a zero default
if ( !ctype_digit( $coord ) ) {
if ( !is_numeric( $coord ) || $coord > 1e9 || $coord < 0 ) {
return self::error( 'imagemap_invalid_coord', $lineNum );
}
$coords[] = $coord;