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

html_to_text is pathologically slow with certain input involving <pre>

    Details

    • Database:
      Any
    • Testing Instructions:
      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
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-30741_master

      Description

      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 />

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  9/Jan/12