Exploit database

GH-14fb583d3d1bd2da10251bb1a37b93d6

gitchw/ghostlock-cve-2026-43499

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-43499

165 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source

Repository files31

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

workspace/decomp/HeyRomUpdate/sources/org/apache/commons/compress/utils/BitInputStream.java

Java · 4,213 bytes
package org.apache.commons.compress.utils;

import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteOrder;

/* loaded from: classes.dex */
public class BitInputStream implements Closeable {
    private static final long[] MASKS = new long[64];
    private static final int MAXIMUM_CACHE_SIZE = 63;
    private long bitsCached;
    private int bitsCachedSize;
    private final ByteOrder byteOrder;
    private final org.apache.commons.io.input.CountingInputStream in;

    static {
        for (int i = 1; i <= 63; i++) {
            long[] jArr = MASKS;
            jArr[i] = (jArr[i - 1] << 1) + 1;
        }
    }

    public BitInputStream(InputStream in, ByteOrder byteOrder) {
        this.in = new org.apache.commons.io.input.CountingInputStream(in);
        this.byteOrder = byteOrder;
    }

    public void alignWithByteBoundary() {
        int toSkip = this.bitsCachedSize % 8;
        if (toSkip > 0) {
            readCachedBits(toSkip);
        }
    }

    public long bitsAvailable() throws IOException {
        return this.bitsCachedSize + (this.in.available() * 8);
    }

    public int bitsCached() {
        return this.bitsCachedSize;
    }

    public void clearBitCache() {
        this.bitsCached = 0L;
        this.bitsCachedSize = 0;
    }

    @Override // java.io.Closeable, java.lang.AutoCloseable
    public void close() throws IOException {
        this.in.close();
    }

    private boolean ensureCache(int count) throws IOException {
        while (true) {
            int i = this.bitsCachedSize;
            if (i < count && i < 57) {
                long nextByte = this.in.read();
                if (nextByte < 0) {
                    return true;
                }
                if (this.byteOrder == ByteOrder.LITTLE_ENDIAN) {
                    this.bitsCached |= nextByte << this.bitsCachedSize;
                } else {
                    long j = this.bitsCached << 8;
                    this.bitsCached = j;
                    this.bitsCached = j | nextByte;
                }
                this.bitsCachedSize += 8;
            } else {
                return false;
            }
        }
    }

    public long getBytesRead() {
        return this.in.getByteCount();
    }

    private long processBitsGreater57(int count) throws IOException {
        long overflow;
        int bitsToAddCount = count - this.bitsCachedSize;
        int overflowBits = 8 - bitsToAddCount;
        long nextByte = this.in.read();
        if (nextByte < 0) {
            return nextByte;
        }
        if (this.byteOrder == ByteOrder.LITTLE_ENDIAN) {
            long[] jArr = MASKS;
            long bitsToAdd = jArr[bitsToAddCount] & nextByte;
            this.bitsCached |= bitsToAdd << this.bitsCachedSize;
            overflow = (nextByte >>> bitsToAddCount) & jArr[overflowBits];
        } else {
            long j = this.bitsCached << bitsToAddCount;
            this.bitsCached = j;
            long[] jArr2 = MASKS;
            long bitsToAdd2 = (nextByte >>> overflowBits) & jArr2[bitsToAddCount];
            this.bitsCached = j | bitsToAdd2;
            overflow = nextByte & jArr2[overflowBits];
        }
        long bitsOut = this.bitsCached & MASKS[count];
        this.bitsCached = overflow;
        this.bitsCachedSize = overflowBits;
        return bitsOut;
    }

    public long readBits(int count) throws IOException {
        if (count < 0 || count > 63) {
            throw new IOException("count must not be negative or greater than 63");
        }
        if (ensureCache(count)) {
            return -1L;
        }
        if (this.bitsCachedSize < count) {
            return processBitsGreater57(count);
        }
        return readCachedBits(count);
    }

    private long readCachedBits(int count) {
        long bitsOut;
        if (this.byteOrder == ByteOrder.LITTLE_ENDIAN) {
            long j = this.bitsCached;
            bitsOut = MASKS[count] & j;
            this.bitsCached = j >>> count;
        } else {
            bitsOut = MASKS[count] & (this.bitsCached >> (this.bitsCachedSize - count));
        }
        this.bitsCachedSize -= count;
        return bitsOut;
    }
}