You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2019/01/02 08:06:00 UTC

[jira] [Work logged] (IMAGING-220) JpegDecoder takes a long time (+10s) to decode a bad JPEG

     [ https://issues.apache.org/jira/browse/IMAGING-220?focusedWorklogId=180063&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-180063 ]

ASF GitHub Bot logged work on IMAGING-220:
------------------------------------------

                Author: ASF GitHub Bot
            Created on: 02/Jan/19 08:05
            Start Date: 02/Jan/19 08:05
    Worklog Time Spent: 10m 
      Work Description: kinow commented on pull request #40: IMAGING-220: replace while by if in the JPEG decoder extend method
URL: https://github.com/apache/commons-imaging/pull/40
 
 
   Looking at the specification and other implementations (see JIRA ticket for links), it appears to me that the `while` in the `extend` method is actually supposed to be an `if`. 
   
   All tests passing after this change, also added an extra test to validate an existing bug found by Guido Vranken, where the decoder would take longer than 10 seconds to process the file. This issue does not apply to Sanselan, only to Commons Imaging.
   
   Will merge in the next days if there are no objections.
   
   Cheers
   Bruno
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Issue Time Tracking
-------------------

            Worklog Id:     (was: 180063)
            Time Spent: 10m
    Remaining Estimate: 0h

> JpegDecoder takes a long time (+10s) to decode a bad JPEG
> ---------------------------------------------------------
>
>                 Key: IMAGING-220
>                 URL: https://issues.apache.org/jira/browse/IMAGING-220
>             Project: Commons Imaging
>          Issue Type: Bug
>            Reporter: Bruno P. Kinoshita
>            Assignee: Bruno P. Kinoshita
>            Priority: Major
>             Fix For: 1.0
>
>         Attachments: Screenshot from 2019-01-02 21-02-41.png, timeout-48eb4251935b4ca8b26d1859ea525c1b42ae0c78
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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.
>  * [https://github.com/libjpeg-turbo/libjpeg-turbo/blob/9bc8eb6449a32f452ab3fc9f94af672a0af13f81/jdphuff.c#L204]
>  * [https://github.com/lifthrasiir/rust-image/blob/ee0e7064d96a1015650481b7046420e6238cf53d/src/jpeg/decoder.rs#L681]
> 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).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)