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

Segfault upgrading question categories - infinite recursion in question_category_next_parent_in()

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.9
    • 1.9.3
    • Questions
    • None
    • MOODLE_19_STABLE
    • MOODLE_19_STABLE

    Description

      Requires broken data in the question categories. Two categories that refer to one another causing a loop, e.g.

      select id, parent from mdl_question_categories where id in (830,882);
      id | parent
      ----+-------
      882 | 830
      830 | 882
      (2 rows)

      I know... should never happen, but above is from a client database.

      http://git.catalyst.net.nz/gitweb?p=moodle-r2.git;a=commitdiff;h=d4354b8332dbed201bffb28164cc8a696fdd71b8 is a defensive patch that prevents the question_category_next_parent_in() function from recursing into a category it has already seen, thus preventing the infinite stack overflow that causes the segfault.

      Attachments

        Issue Links

          Activity

            People

              timhunt Tim Hunt
              jonathan Jonathan Harker
              Tim Hunt, Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                15/Oct/08