private COSObjectKey getObjectKey(COSBase obj) {
        COSBase actual = obj;
        if (actual instanceof COSObject) {
            actual = ((COSObject) obj).getObject();
        }
        // PDFBOX-4540: because objectKeys is accessible from outside, it is possible
        // that a COSObject obj is already in the objectKeys map.
        COSObjectKey key = objectKeys.get(obj);
        if (key == null && actual != null) {
            key = objectKeys.get(actual);
        }
        if (key == null) {
            setNumber(getNumber() + 1);
            key = new COSObjectKey(getNumber(), 0);
            objectKeys.put(obj, key);
            if (actual != null) {
                objectKeys.put(actual, key);
            }
        }
        return key;
    }
This will get the object key for the object.

@param obj The object to get the key for.
@return The object key for the object.
tika-fuzzing/src/main/java/org/apache/tika/fuzzing/pdf/EvilCOSWriter.java