Skip to content

Commit

Permalink
MDL-69911 core: Clean content passed through TeX filter
Browse files Browse the repository at this point in the history
  • Loading branch information
mickhawkins authored and Jenkins committed Jan 12, 2021
1 parent ce87be7 commit 11e13d1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions filter/tex/filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ function filter($text, array $options = array()) {
continue;
}

// Sanitize the decoded string, because filter_text_image() injects the final string between script tags.
$texexp = clean_param($texexp, PARAM_TEXT);

$md5 = md5($texexp);
if (!$DB->record_exists("cache_filters", array("filter"=>"tex", "md5key"=>$md5))) {
$texcache = new stdClass();
Expand Down

2 comments on commit 11e13d1

@vodingithub
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello. We got a problem. This function truncates TEX formulas like ( F(x)=\left{\begin{matrix} 0, & x<a \ \frac{x-a}{b-a}, & a \leq x \leq b\ 1, & x>b \end{matrix}\right . ). А block between "<" and ">" characters is cut out ( <a \ \frac{x-a}{b-a}, & a \leq x \leq b\ 1, & x> ). What should we do?

@mickhawkins
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @vodingithub, thanks for reaching out. If this is causing issues with legitimate TeX formulas, it would be great if you can report the bug in the Moodle Tracker so we can add it to our backlog and look into the issue further.

Please sign in to comment.