It looks like there are two missing else parts in
BaseParser#readUntilEndStream.

The last part when trying to match "endstream" contains this:

if(byteRead==M){
    //found the whole marker
    pdfSource.unread( ENDSTREAM );
    return;
}

But what happens when the last character is not "m" (for example
endstreaX). Because there is no else statement it seems that "endstrea"
is never written. Shouldn't it be:

if(byteRead==M){
    //found the whole marker
    pdfSource.unread( ENDSTREAM );
    return;
}
else {
    out.write(ENDSTREAM, 0, 8);
}

Similar thing happens happens below when matching "endobj".

If the last character does not match "j". "endob" is not written:

if(byteRead==J){
    //found whole marker
    pdfSource.unread( ENDOBJ );
    return;
}

shouldn't it be:

if(byteRead==J){
    //found whole marker
    pdfSource.unread( ENDOBJ );
    return;
}
else {
    out.write(ENDOBJ, 0, 5);
}


Am I missing something?

Kind regards,

Martijn Brinkers

Reply via email to