Harmony
  1. Harmony
  2. HARMONY-6384

Jar decoding breaks upon encountering a Z_SYNC_FLUSH block

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.0M3, 5.0M15
    • Component/s: Classlib
    • Labels:
      None
    • Environment:
      SVN Revision: 883501

      Description

      The "new JarFile()" constructor throws an exception when decoding a JarFile that contains a Z_SYNC_FLUSH block. The RI is able to decode such files without problem.
      See also http://markmail.org/thread/7xyxtpri3clhu3hv

      1. JarDecodingFix.patch
        1 kB
        Colin Thorne
      2. hyts_flushed.jar
        2 kB
        Jesse Wilson
      3. JarDecodingBug.patch
        1 kB
        Jesse Wilson

        Activity

        Hide
        Hudson added a comment -

        Integrated in Harmony-select-1.5-head-linux-x86_64 #65 (See http://hudson.zones.apache.org/hudson/job/Harmony-select-1.5-head-linux-x86_64/65/)
        Fix comments in regression test for "HARMONY-6384 Jar decoding breaks upon
        encountering a Z_SYNC_FLUSH block".

        Show
        Hudson added a comment - Integrated in Harmony-select-1.5-head-linux-x86_64 #65 (See http://hudson.zones.apache.org/hudson/job/Harmony-select-1.5-head-linux-x86_64/65/ ) Fix comments in regression test for " HARMONY-6384 Jar decoding breaks upon encountering a Z_SYNC_FLUSH block".
        Hide
        Hudson added a comment -

        Integrated in Harmony-1.5-head-linux-x86_64 #894 (See http://hudson.zones.apache.org/hudson/job/Harmony-1.5-head-linux-x86_64/894/)
        Fix comments in regression test for "HARMONY-6384 Jar decoding breaks upon
        encountering a Z_SYNC_FLUSH block".

        Show
        Hudson added a comment - Integrated in Harmony-1.5-head-linux-x86_64 #894 (See http://hudson.zones.apache.org/hudson/job/Harmony-1.5-head-linux-x86_64/894/ ) Fix comments in regression test for " HARMONY-6384 Jar decoding breaks upon encountering a Z_SYNC_FLUSH block".
        Hide
        Mark Hindess added a comment -

        Fixed comments in the regression test at r964468.

        Show
        Mark Hindess added a comment - Fixed comments in the regression test at r964468.
        Hide
        Jesse Wilson added a comment -

        Sounds good to me.

        Show
        Jesse Wilson added a comment - Sounds good to me.
        Hide
        Colin Thorne added a comment -

        I have checked that you have applied the patches as expected. My only comment is that the test patch for JarFileTest.java includes the comment "// Harmony crashes with ZipException: Central Directory Entry not found" which it doesn't anymore

        I don't think I should close this bug because I didn't raise it.

        Show
        Colin Thorne added a comment - I have checked that you have applied the patches as expected. My only comment is that the test patch for JarFileTest.java includes the comment "// Harmony crashes with ZipException: Central Directory Entry not found" which it doesn't anymore I don't think I should close this bug because I didn't raise it.
        Hide
        Hudson added a comment -

        Integrated in Harmony-select-1.5-head-linux-x86_64 #63 (See http://hudson.zones.apache.org/hudson/job/Harmony-select-1.5-head-linux-x86_64/63/)
        Applying patches from "HARMONY-6384 Jar decoding breaks upon
        encountering a Z_SYNC_FLUSH block".

        Show
        Hudson added a comment - Integrated in Harmony-select-1.5-head-linux-x86_64 #63 (See http://hudson.zones.apache.org/hudson/job/Harmony-select-1.5-head-linux-x86_64/63/ ) Applying patches from " HARMONY-6384 Jar decoding breaks upon encountering a Z_SYNC_FLUSH block".
        Hide
        Hudson added a comment -

        Integrated in Harmony-1.5-head-linux-x86_64 #892 (See http://hudson.zones.apache.org/hudson/job/Harmony-1.5-head-linux-x86_64/892/)
        Applying patches from "HARMONY-6384 Jar decoding breaks upon
        encountering a Z_SYNC_FLUSH block".

        Show
        Hudson added a comment - Integrated in Harmony-1.5-head-linux-x86_64 #892 (See http://hudson.zones.apache.org/hudson/job/Harmony-1.5-head-linux-x86_64/892/ ) Applying patches from " HARMONY-6384 Jar decoding breaks upon encountering a Z_SYNC_FLUSH block".
        Hide
        Mark Hindess added a comment -

        Applied patch in r964042. Please confirm (by closing this JIRA) that it has been applied as expected.

        Show
        Mark Hindess added a comment - Applied patch in r964042. Please confirm (by closing this JIRA) that it has been applied as expected.
        Hide
        Colin Thorne added a comment -

        I have added my patch for this bug which fixes the behaviour for the test case already attached to this bug. I have also managed to find a way of creating a jar file which reproduces the problem on Harmony (using a modified version of the Harmony archive classes to expose the z_sync_flush flag) but I need to try out other behaviour of the RI to check my understanding of the possible format of the jar files.
        Essentially, in the z_sync_flush case: the offset stored in the ZIP 'end of central directory record' does not point to the beginning of the central directory, but instead points to the beginning of the z_sync_flush block that preceeds the beginning of the central directory.

        Show
        Colin Thorne added a comment - I have added my patch for this bug which fixes the behaviour for the test case already attached to this bug. I have also managed to find a way of creating a jar file which reproduces the problem on Harmony (using a modified version of the Harmony archive classes to expose the z_sync_flush flag) but I need to try out other behaviour of the RI to check my understanding of the possible format of the jar files. Essentially, in the z_sync_flush case: the offset stored in the ZIP 'end of central directory record' does not point to the beginning of the central directory, but instead points to the beginning of the z_sync_flush block that preceeds the beginning of the central directory.
        Hide
        Colin Thorne added a comment -

        Patch to search for Central Directory signature when Z_SYNC_FLUSH has been used.

        Show
        Colin Thorne added a comment - Patch to search for Central Directory signature when Z_SYNC_FLUSH has been used.
        Hide
        Tim Ellison added a comment -

        Colin, can you share your patch for review while you figure out how to create the additional tests?

        Show
        Tim Ellison added a comment - Colin, can you share your patch for review while you figure out how to create the additional tests?
        Hide
        Colin Thorne added a comment -

        I have been looking at this bug and I have a patch available which fixes the problem for the example hyts_flushed.jar that is provided as a testcase. I was trying to create some more examples (just to check my understanding of the problem) but I couldn't find a way of creating a similar jar. How did you manage to create this failing jar file?

        Show
        Colin Thorne added a comment - I have been looking at this bug and I have a patch available which fixes the problem for the example hyts_flushed.jar that is provided as a testcase. I was trying to create some more examples (just to check my understanding of the problem) but I couldn't find a way of creating a similar jar. How did you manage to create this failing jar file?
        Hide
        Jesse Wilson added a comment -

        Testcase that demonstrates the problem.
        Attached file should be copied to working_classlib/support/src/test/java/tests/resources/hyts_flushed.jar

        Show
        Jesse Wilson added a comment - Testcase that demonstrates the problem. Attached file should be copied to working_classlib/support/src/test/java/tests/resources/hyts_flushed.jar

          People

          • Assignee:
            Mark Hindess
            Reporter:
            Jesse Wilson
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development