You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "martijn.list" <ma...@gmail.com> on 2010/11/25 10:30:12 UTC

Missing else in readUntilEndStream?

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


Re: Missing else in readUntilEndStream?

Posted by Ad...@swmc.com.
No, it looks like you're on to something there.  I've created an issue on 
JIRA (PDFBOX-910) added the patch (revision 1040218) and marked it as 
resolved.  Nice catch!

---- 
Thanks,
Adam



From:
"martijn.list" <ma...@gmail.com>
To:
dev@pdfbox.apache.org
Date:
11/25/2010 01:30
Subject:
Missing else in readUntilEndStream?



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






- FHA 203b; 203k; HECM; VA; USDA; Conventional 
- Warehouse Lines; FHA-Authorized Originators 
- Lending and Servicing in over 45 States 
www.swmc.com   -  www.simplehecmcalculator.com   
Visit  www.swmc.com/resources   for helpful links on Training, Webinars, Lender Alerts and Submitting Conditions  

This email and any content within or attached hereto from Sun West Mortgage Company, Inc. is confidential and/or legally privileged. The information is intended only for the use of the individual or entity named on this email. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or taking any action in reliance on the contents of this email information is strictly prohibited, and that the documents should be returned to this office immediately by email. Receipt by anyone other than the intended recipient is not a waiver of any privilege. Please do not include your social security number, account number, or any other personal or financial information in the content of the email. Should you have any questions, please call (800) 453 7884.