Paranoia, escape image alignment parameters before outputting.
authorBrian Wolff <bawolff+wn@gmail.com>
Wed, 13 Jun 2018 15:28:20 +0000 (15:28 +0000)
committerBrian Wolff <bawolff+wn@gmail.com>
Mon, 13 Aug 2018 23:30:50 +0000 (23:30 +0000)
The alignment parameter is totally safe (See the very convoluted
code in the parser) but its best practise to escape things right
before the output. Additionally this protects in case any extension
uses a hook to do anything silly.

Change-Id: Ie19b106409d55c704b69280e2d0e2bb29068bd2e

includes/Linker.php

index 89a6a10..adc0297 100644 (file)
@@ -431,7 +431,11 @@ class Linker {
                        $s = $thumb->toHtml( $params );
                }
                if ( $frameParams['align'] != '' ) {
-                       $s = "<div class=\"float{$frameParams['align']}\">{$s}</div>";
+                       $s = Html::rawElement(
+                               'div',
+                               [ 'class' => 'float' . $frameParams['align'] ],
+                               $s
+                       );
                }
                return str_replace( "\n", ' ', $prefix . $s . $postfix );
        }