From 00015b8bf2243f2ed87c353ab3fd7e6fd241c842 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sat, 3 Jun 2006 00:24:04 +0000 Subject: [PATCH] * Fix fatal error when specifying illegal name for manual thumbnail --- RELEASE-NOTES | 2 ++ includes/Linker.php | 20 +++++++++++--------- maintenance/parserTests.txt | 9 +++++++++ 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 113f33e5ac..993e0f5180 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -415,6 +415,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 6171) Fix sanitizing of HTML-elements with an optional closing tag. The sanitizer still needs to learn how to make well-formed XML in this case. +* Fix fatal error when specifying illegal name for manual thumbnail + == Compatibility == diff --git a/includes/Linker.php b/includes/Linker.php index 30d0a310d1..44d179973e 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -603,15 +603,17 @@ class Linker { if ( $manual_thumb != '' ) # Use manually specified thumbnail { $manual_title = Title::makeTitleSafe( NS_IMAGE, $manual_thumb ); #new Title ( $manual_thumb ) ; - $manual_img = new Image( $manual_title ); - $thumbUrl = $manual_img->getViewURL(); - if ( $manual_img->exists() ) - { - $width = $manual_img->getWidth(); - $height = $manual_img->getHeight(); - $boxwidth = $width ; - $boxheight = $height ; - $oboxwidth = $boxwidth + 2 ; + if( $manual_title ) { + $manual_img = new Image( $manual_title ); + $thumbUrl = $manual_img->getViewURL(); + if ( $manual_img->exists() ) + { + $width = $manual_img->getWidth(); + $height = $manual_img->getHeight(); + $boxwidth = $width ; + $boxheight = $height ; + $oboxwidth = $boxwidth + 2 ; + } } } diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt index 05b67ba80a..5158a16360 100644 --- a/maintenance/parserTests.txt +++ b/maintenance/parserTests.txt @@ -4293,6 +4293,15 @@ http://example.com
junk
!!end +!!test +Fuzz testing: image with bogus manual thumbnail +!!input +[[Image:foobar.jpg|thumbnail= ]] +!!result +
Enlarge
+ +!!end + !! test Parsing optional HTML elements (Bug 6171) !! options -- 2.20.1