Skip to content

Commit

Permalink
Merge pull request #119 from wikimedia/fix-crop
Browse files Browse the repository at this point in the history
Fix crop URL parameter sanitization
  • Loading branch information
samwilson authored Nov 28, 2023
2 parents 14e1b9e + 37cbd16 commit 7ba3b50
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Controller/OcrController.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ private function setup(): void {
static::$params['langs'] = $this->getLangs( $this->request );
static::$params['image_hosts'] = $this->engine->getImageHosts();
$crop = $this->request->query->get( 'crop' );
if ( !is_array( $crop ) ) {
if ( !is_array( $crop )
|| isset( $crop['width'] ) && !$crop['width']
|| isset( $crop['height'] ) && !$crop['height']
) {
$crop = [];
}
static::$params['crop'] = array_map( 'intval', $crop );
Expand Down

0 comments on commit 7ba3b50

Please sign in to comment.