public MSCabinetFile()

in jsign-core/src/main/java/net/jsign/mscab/MSCabinetFile.java [111:135]


    public MSCabinetFile(SeekableByteChannel channel) throws IOException {
        this.channel = channel;

        channel.position(0);
        header.read(channel);

        if (header.csumHeader != 0) {
            throw new IOException("MSCabinet file is corrupt: invalid reserved field in the header");
        }

        if (header.isReservePresent()) {
            if (header.cbCFHeader != CABSignature.SIZE) {
                throw new IOException("MSCabinet file is corrupt: cabinet reserved area size is " + header.cbCFHeader + " instead of " + CABSignature.SIZE);
            }

            CABSignature cabsig = header.getSignature();
            if (cabsig.header != CABSignature.HEADER) {
                throw new IOException("MSCabinet file is corrupt: signature header is " + cabsig.header);
            }

            if (cabsig.offset < channel.size() && (cabsig.offset + cabsig.length) > channel.size() || cabsig.offset > channel.size()) {
                throw new IOException("MSCabinet file is corrupt: signature data (offset=" + cabsig.offset + ", size=" + cabsig.length + ") after the end of the file");
            }
        }
    }