Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F37122588
0004-A-manualthumb-that-doesn-t-exist-should-be-considere.patch
Arlolra (Arlo Breault)
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
Arlolra
Jun 29 2023, 12:59 AM
2023-06-29 00:59:24 (UTC+0)
Size
2 KB
Referenced Files
None
Subscribers
None
0004-A-manualthumb-that-doesn-t-exist-should-be-considere.patch
View Options
From 98cf0a07b3e1a83a0eba7f5f6586faadedf8f7ec Mon Sep 17 00:00:00 2001
From: Arlo Breault <abreault@wikimedia.org>
Date: Wed, 28 Jun 2023 20:40:11 -0400
Subject: [PATCH 4/5] A manualthumb that doesn't exist should be considered a
thumb error
Resetting $exist will result in a redlink when what we really want is a
thumb error. The file exists, we just failed to generate a thumbnail
for it.
Change-Id: Id6971d5214dfe9a06418ddc046bde9e45a8bae13
---
includes/Linker.php | 2 --
tests/parser/mediaParserTests.txt | 12 ++++++++++++
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/includes/Linker.php b/includes/Linker.php
index 4638ec4ae71..caf48a22c4f 100644
--- a/includes/Linker.php
+++ b/includes/Linker.php
@@ -671,8 +671,6 @@ class Linker {
if ( $manual_img ) {
$thumb = $manual_img->getUnscaledThumb( $handlerParams );
$manualthumb = true;
- } else {
- $exists = false;
}
}
} elseif ( isset( $frameParams['framed'] ) ) {
diff --git a/tests/parser/mediaParserTests.txt b/tests/parser/mediaParserTests.txt
index a040b8ffcfb..ecd12cbece4 100644
--- a/tests/parser/mediaParserTests.txt
+++ b/tests/parser/mediaParserTests.txt
@@ -4301,3 +4301,15 @@ wgParserEnableLegacyMediaDOM=false
<figure typeof="mw:Error mw:File/Frame" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Barfoo.jpg"><span class="mw-broken-media" resource="./File:Barfoo.jpg">File:Barfoo.jpg</span></a><figcaption>123</figcaption></figure>
<p><span class="mw-default-size" typeof="mw:Error mw:File/Frameless" data-mw='{"caption":"123","errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Barfoo.jpg"><span class="mw-broken-media" resource="./File:Barfoo.jpg" data-width="180">123</span></a></span></p>
!! end
+
+!! test
+Media with broken manualthumb
+!! config
+wgParserEnableLegacyMediaDOM=false
+!! wikitext
+[[File:Foobar.jpg|thumbnail=Barfoo.jpg|123]]
+!! html/php
+<figure typeof="mw:Error mw:File/Thumb"><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg"><span class="mw-broken-media" data-width="180">Error creating thumbnail: </span></a><figcaption>123</figcaption></figure>
+!! html/parsoid
+<figure typeof="mw:Error mw:File/Thumb" data-mw='{"attribs":[["manualthumb",{"txt":"Barfoo.jpg"}]],"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Foobar.jpg"><span class="mw-broken-media" resource="./File:Foobar.jpg">File:Foobar.jpg</span></a><figcaption>123</figcaption></figure>
+!! end
--
2.41.0
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
10911441
Default Alt Text
0004-A-manualthumb-that-doesn-t-exist-should-be-considere.patch (2 KB)
Attached To
Mode
T335612: CVE-2023-36674: Manualthumb bypasses badFile lookup
Attached
Detach File
Event Timeline
Log In to Comment