(requires PHP 5, XMLReader extension)
* (bug 2773) Print style sheet no longer overrides RTL text direction
* (bug 2938) Update MediaWiki:Exporttext to be more general
+* Fixed possible infinite loop in formatComment
+* Added a limit to the size of image files which can be thumbnailed
=== Caveats ===
$wgSVGConverterPath = '';
/** Don't scale a SVG larger than this unless its native size is larger */
$wgSVGMaxSize = 1024;
+/**
+ * Don't thumbnail an image if it will use too much working memory
+ * Default is 50 MB if decompressed to RGBA form, which corresponds to
+ * 12.5 million pixels or 3500x3500
+ */
+$wgMaxImageArea = 1.25e7;
/** Set $wgCommandLineMode if it's not set already, to avoid notices */
if( !isset( $wgCommandLineMode ) ) {
function renderThumb( $width, $useScript = true ) {
global $wgUseSquid, $wgInternalServer;
global $wgThumbnailScriptPath, $wgSharedThumbnailScriptPath;
+ global $wgSVGMaxSize, $wgMaxImageArea;
$fname = 'Image::renderThumb';
wfProfileIn( $fname );
return null;
}
- global $wgSVGMaxSize;
+ # Don't thumbnail an image so big that it will fill hard drives and send servers into swap
+ # JPEG has the handy property of allowing thumbnailing without full decompression, so we make
+ # an exception for it.
+ if ( $this->getMimeType() !== "image/jpeg" && $this->width * $this->height > $wgMaxImageArea ) {
+ wfProfileOut( $fname );
+ return null;
+ }
+
$maxsize = $this->mustRender()
? max( $this->width, $wgSVGMaxSize )
: $this->width - 1;