Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-7239

Infinite loop in XWikiAttachment.getVersionList() consumes all available memory when called.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Blocker
    • 3.3-rc-1
    • 3.3-milestone-2
    • Storage
    • None
    • Unit
    • Unknown

    Description

      To repeat:

      • Upload an attachment, upload it again so it's version 1.2
      • Paste this code into the document:
        {{velocity}}
        $doc.getAttachmentList().get(0).getVersionList()
        {{/velocity}}
        

      Observe an OOM error:

      Caused by: java.lang.OutOfMemoryError: Java heap space
      	at java.util.Arrays.copyOf(Arrays.java:2734)
      	at java.util.ArrayList.ensureCapacity(ArrayList.java:167)
      	at java.util.ArrayList.add(ArrayList.java:351)
      	at com.xpn.xwiki.doc.XWikiAttachment.getVersionList(XWikiAttachment.java:607)
      	at com.xpn.xwiki.api.Attachment.getVersionList(Attachment.java:169)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      

      This is caused by questionable usage of Version.next() which appears to have been broken by an api change or bug fix.

      Attachments

        Activity

          People

            calebjamesdelisle CalebJamesDeLisle
            calebjamesdelisle CalebJamesDeLisle
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: