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

Attached image file loops away until PHP timeout

    XMLWordPrintable

    Details

    • Affected Branches:
      MOODLE_39_STABLE

      Description

      A user tried to embed the same image that was posted as an attachment for the File resource in the description field. That caused a loop in the lib/filelib.php in the following lines:

      if ($stored_file && $stored_file->is_external_file() && !isset($options['sendcachedexternalfile']))

      $stored_file->send_file($lifetime, $filter, $forcedownload, $options); die;

      because !isset($options['sendcachedexternalfile']) was never true.

      Of course at trying to reproduce the error, we got the warning that this kind of attachment is not correct way of using the resource, yet it was still possible to force the embedding.

      The user succeeded to embed the image to the description twice which then resulted in a very slow response of the whole course (and impossible to turn on editing). There were 504 timeouts by php-fpm for all the included images.

      While user does get a warning before doing this, I believe this is not enough to prevent user error which is then very tricky to resolve by disabling the attached files in the SQL table mdl_files.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            bozicm bozicm
            Participants:
            Component watchers:
            Matteo Scaramuccia, Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated: