Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-30741

html_to_text is pathologically slow with certain input involving <pre>

XMLWordPrintable

    • Any
    • MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE
    • MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • MDL-30741_master
    • Hide
      1. Place the attached script into the root of your Moodle site
      2. Run the attached script via a web browser
      3. The output should be:
        • without the patched code – the page will run for however long your PHP timeout is set to, and then display the conversion result for the first string and the second string without a converted result
        • with the patches code – the page will load and both strings will be converted from their HTML format into text and displayed on the page very quickly
      Show
      Place the attached script into the root of your Moodle site Run the attached script via a web browser The output should be: without the patched code – the page will run for however long your PHP timeout is set to, and then display the conversion result for the first string and the second string without a converted result with the patches code – the page will load and both strings will be converted from their HTML format into text and displayed on the page very quickly

      The following string value from a quiz question was causing the convert_pre() method in _/lib/html2text.php to get stuck and never finish converting the string to a text representation:

      Consider the following function:<br /><pre style="color: rgb(153, 51, 102);">void FillMeUp(char* in_string) {<br />  int i = 0;<br />  while (in_string[i] != '\0') {<br />    in_string[i] = 'X';<br />    i++;<br />  }<br />}</pre>What would happen if a non-terminated string were input to this function?<br /><br />

            jfilip Justin Filip (Inactive)
            jfilip Justin Filip (Inactive)
            Tim Hunt Tim Hunt
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Ankit Agarwal Ankit Agarwal
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.