jdk/test/tools/launcher/6842838/CreateBadJar.java
author chegar
Thu, 03 Jan 2013 10:00:55 +0000
changeset 14998 b9a99aac309e
parent 5506 202f599c92aa
permissions -rw-r--r--
8005634: tools/launcher/VersionCheck.java fails version check on jdeps Summary: add jdeps to the list of tools that do not support '-version' Reviewed-by: mchung
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3848
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3848
diff changeset
     2
 * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
3848
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
     4
 *
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
     7
 * published by the Free Software Foundation.
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
     8
 *
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    13
 * accompanied this code).
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    14
 *
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    18
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3848
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3848
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3848
diff changeset
    21
 * questions.
3848
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    22
 */
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    23
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    24
/*
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    25
 * Borrowing significantly from Martin Buchholz's CorruptedZipFiles.java
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    26
 *
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    27
 * Needed a way of testing the checks for corrupt zip/jar entry in
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    28
 * inflate_file from file j2se/src/share/bin/parse_manifest.c
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    29
 * and running them with the 64-bit launcher. e.g.
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    30
 * sparcv9/bin/java -jar badjar.jar
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    31
 *
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    32
 * Run from a script driver Test6842838.sh as we want to specifically run
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    33
 * bin/sparcv9/java, the 64-bit launcher.
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    34
 *
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    35
 * So this program will create a zip file and damage it in the way
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    36
 * required to tickle this bug.
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    37
 *
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    38
 * It will cause a buffer overrun: but that will not always crash.
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    39
 * Use libumem preloaded by the script driver in order to
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    40
 * abort quickly when the overrun happens.  That makes the test
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    41
 * Solaris-specific.
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    42
 */
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    43
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    44
import java.util.*;
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    45
import java.util.zip.*;
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    46
import java.io.*;
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    47
import static java.lang.System.*;
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    48
import static java.util.zip.ZipFile.*;
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    49
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    50
public class CreateBadJar {
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    51
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    52
public static void main(String [] arguments) {
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    53
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    54
        if (arguments.length != 2) {
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    55
            throw new RuntimeException("Arguments: jarfilename entryname");
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    56
        }
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    57
        String outFile = arguments[0];
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    58
        String entryName = arguments[1];
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    59
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    60
        try {
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    61
        // If the named file doesn't exist, create it.
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    62
        // If it does, we are expecting it to contain the named entry, for
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    63
        // alteration.
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    64
        if (!new File(outFile).exists()) {
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    65
          System.out.println("Creating file " + outFile);
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    66
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    67
          // Create the requested zip/jar file.
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    68
          ZipOutputStream zos = null;
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    69
          zos = new ZipOutputStream(
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    70
            new FileOutputStream(outFile));
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    71
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    72
          ZipEntry e = new ZipEntry(entryName);
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    73
          zos.putNextEntry(e);
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    74
          for (int j=0; j<50000; j++) {
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    75
            zos.write((int)'a');
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    76
          }
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    77
          zos.closeEntry();
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    78
          zos.close();
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    79
          zos = null;
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    80
        }
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    81
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    82
        // Read it.
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    83
        int len = (int)(new File(outFile).length());
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    84
        byte[] good = new byte[len];
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    85
        FileInputStream fis = new FileInputStream(outFile);
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    86
        fis.read(good);
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    87
        fis.close();
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    88
        fis = null;
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    89
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    90
        int endpos = len - ENDHDR;
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    91
        int cenpos = u16(good, endpos+ENDOFF);
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    92
        if (u32(good, cenpos) != CENSIG) throw new RuntimeException("Where's CENSIG?");
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    93
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    94
        byte[] bad;
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    95
        bad = good.clone();
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    96
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    97
        // Corrupt it...
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    98
        int pos = findInCEN(bad, cenpos, entryName);
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    99
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   100
        // What bad stuff are we doing to it?
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   101
        // Store a 32-bit -1 in uncomp size.
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   102
        bad[pos+0x18]=(byte)0xff;
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   103
        bad[pos+0x19]=(byte)0xff;
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   104
        bad[pos+0x1a]=(byte)0xff;
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   105
        bad[pos+0x1b]=(byte)0xff;
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   106
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   107
        // Bad work complete, delete the original.
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   108
        new File(outFile).delete();
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   109
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   110
        // Write it.
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   111
        FileOutputStream fos = new FileOutputStream(outFile);
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   112
        fos.write(bad);
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   113
        fos.close();
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   114
        fos = null;
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   115
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   116
        } catch (Exception e) {
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   117
            e.printStackTrace();
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   118
        }
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   119
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   120
}
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   121
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   122
        /*
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   123
         * Scan Central Directory File Headers looking for the named entry.
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   124
         */
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   125
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   126
    static int findInCEN(byte[] bytes, int cenpos, String entryName) {
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   127
        int pos = cenpos;
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   128
        int nextPos = 0;
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   129
        String filename = null;
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   130
        do {
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   131
            if (nextPos != 0) {
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   132
                pos = nextPos;
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   133
            }
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   134
            System.out.println("entry at pos = " + pos);
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   135
            if (u32(bytes, pos) != CENSIG) throw new RuntimeException ("entry not found in CEN or premature end...");
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   136
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   137
            int csize = u32(bytes, pos+0x14);          // +0x14 1 dword csize
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   138
            int uncompsize = u32(bytes, pos+0x18);     // +0x18 1 dword uncomp size
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   139
            int filenameLength = u16(bytes, pos+0x1c); // +0x1c 1 word length of filename
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   140
            int extraLength = u16(bytes, pos+0x1e);    // +0x1e 1 world length of extra field
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   141
            int commentLength = u16(bytes, pos+0x20);  // +0x20 1 world length of file comment
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   142
            filename = new String(bytes, pos+0x2e, filenameLength); // +0x2e chars of filename
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   143
            int offset = u32(bytes, pos+0x2a);         // +0x2a chars of filename
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   144
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   145
            System.out.println("filename = " + filename + "\ncsize = " + csize +
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   146
                               " uncomp.size = " + uncompsize +" file offset = " + offset);
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   147
            nextPos =  pos + 0x2e + filenameLength + extraLength + commentLength;
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   148
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   149
        } while (!filename.equals(entryName));
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   150
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   151
        System.out.println("entry found at pos = " + pos);
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   152
        return pos;
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   153
    }
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   154
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   155
    static int u8(byte[] data, int offset) {
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   156
        return data[offset]&0xff;
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   157
    }
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   158
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   159
    static int u16(byte[] data, int offset) {
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   160
        return u8(data,offset) + (u8(data,offset+1)<<8);
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   161
    }
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   162
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   163
    static int u32(byte[] data, int offset) {
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   164
        return u16(data,offset) + (u16(data,offset+2)<<16);
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   165
    }
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   166
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   167
}
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
   168