Uploaded image for project: 'Commons Imaging'
  1. Commons Imaging
  2. IMAGING-220

JpegDecoder takes a long time (+10s) to decode a bad JPEG

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.0-alpha1
    • None
    • None
    • Patch

    Description

      Debugging the code I suspected there was something weird, as it would stay a long time in the while look as a += operation had no effect. Then looked up for the extend and section number.

      The extend method in the JpegDecoder is using a while instead of an if. If you look at the specification, it is not clear whether it is an if or while, but it looks to me like it is a simple if condition.

      Furthermore, if you look at the following examples, it is possible to confirm others implemented the bit extension method with a simple if.

      This does not occur in Sanselan as there is JpegDecoder and no extend method as well. Attaching example file that takes over 10 seconds to be processed (up to the point where the decoder throws an exception actually).

      Attachments

        1. Screenshot from 2019-01-02 21-02-41.png
          76 kB
          Bruno P. Kinoshita
        2. timeout-48eb4251935b4ca8b26d1859ea525c1b42ae0c78
          0.9 kB
          Bruno P. Kinoshita

        Issue Links

          Activity

            People

              kinow Bruno P. Kinoshita
              kinow Bruno P. Kinoshita
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h