Here's some quick code, replace the beginning of the method "visitFromDictionary(COSDictionary obj)" with it

if (!reachedSignature && incrementalUpdate)
{
    COSBase itemType = obj.getItem(COSName.TYPE);
    if (COSName.SIG.equals(itemType) || COSName.DOC_TIME_STAMP.equals(itemType))
    {
        COSArray byteRange = obj.getCOSArray(COSName.BYTERANGE);
        if (byteRange != null && byteRange.size() == 4)
        {
            COSBase base2 = byteRange.getObject(2);
            COSBase base3 = byteRange.getObject(3);
            if (base2 instanceof COSInteger && base3 instanceof COSInteger)
            {
                long br2 = ((COSInteger) base2).longValue();
                long br3 = ((COSInteger) base3).longValue();
                if (br2 + br3 > incrementalInput.length())
                {
                    reachedSignature = true;
                }
                else
                {
                    //TODO log warning
                }
            }
        }
    }
}

Tilman


On 27.09.2022 08:27, Tilman Hausherr wrote:
I'm thinking of adding some code that checks whether it is an "old" signature by comparing it to these huge values that we use (or better, by comparing value[2] + value[3] to the length of the input file). This would then skip these old signatures. Best place would be the segment where "reachedSignature = true" is hit. And also add a warning when we encounter such old signatures, as this shouldn't happen in incremental save.

Tilman


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to