Page MenuHomePhabricator

Division by 0 in PagedTiffHandler_body.php on line 807 (and 806)
Closed, ResolvedPublic

Description

Spotted in production:

Warning: Division by zero in /srv/mediawiki/php-1.26wmf18/extensions/PagedTiffHandler/PagedTiffHandler_body.php on line 806

Also seen on line 807.

Event Timeline

demon created this task.Aug 13 2015, 7:18 PM
demon raised the priority of this task from to Normal.
demon updated the task description. (Show Details)
demon added a subscriber: demon.
Restricted Application added a project: Multimedia. · View Herald TranscriptAug 13 2015, 7:18 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Restricted Application added a subscriber: Matanya. · View Herald TranscriptAug 13 2015, 7:19 PM
demon added a comment.Aug 13 2015, 7:21 PM

Probably happens when $srcWidth is 0.

Jdforrester-WMF moved this task from Untriaged to Backlog on the Multimedia board.Sep 4 2015, 6:22 PM
Dereckson added a subscriber: Dereckson.

$wgTiffIntermediaryScaleStep is at 2048

So if width is 0, this code isn't executed, but if the width is exactly 2048, we've $rx = floor( $srcWidth / ( $wgTiffIntermediaryScaleStep + 0.125 ) );

width / scale step is so 0.99993896856881, reduced to 0 by floor.

At 2049, that works again and we've a factor 1.

There are extraneous round function around $rx, that's an hint the floor is more recent.

Change 299967 had a related patch set uploaded (by Dereckson):
Fix calculations in PagedTiffHandler::getIntermediaryStep

https://gerrit.wikimedia.org/r/299967

Change 299967 merged by jenkins-bot:
Fix calculations in PagedTiffHandler::getIntermediaryStep

https://gerrit.wikimedia.org/r/299967

Change 300097 had a related patch set uploaded (by Dereckson):
Fix calculations in PagedTiffHandler::getIntermediaryStep

https://gerrit.wikimedia.org/r/300097

Change 300097 merged by jenkins-bot:
Fix calculations in PagedTiffHandler::getIntermediaryStep

https://gerrit.wikimedia.org/r/300097

Dereckson closed this task as Resolved.Jul 20 2016, 8:43 PM