Hi Andreas,

of course it should - too early in the morning for me :-)

Unfortunately it doesn't let me commit the fix - could you try?

Maruan Sahyoun

Am 06.12.2013 um 08:43 schrieb Andreas Lehmkühler <[email protected]>:

> Hi,
> 
>> [email protected] hat am 6. Dezember 2013 um 08:15 geschrieben:
>> 
>> 
>> Author: msahyoun
>> Date: Fri Dec  6 07:15:36 2013
>> New Revision: 1548387
>> 
>> URL: http://svn.apache.org/r1548387
>> Log:
>> Fix for infinite loop in parseCOSHexString [PDFBOX-1796]
>> 
>> Modified:
>>    
>>  
>> pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java
>> 
>> Modified:
>> pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java
>> URL:
>> http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java?rev=1548387&r1=1548386&r2=1548387&view=diff
>> ==============================================================================
>> ---
>> pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java
>> (original)
>> +++
>> pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java
>> Fri Dec  6 07:15:36 2013
>> @@ -1008,7 +1008,15 @@ public abstract class BaseParser
>>                   do
>>                   {
>>                       c = pdfSource.read();
>> -                } while ( c != '>' );
>> +                } while ( c != '>' && c < 0 );
> I guess there is a typo? It should be the following, shouldn't it?
> 
>                 } while ( c != '>' && c >= 0 );
> 
>> +               
>> +                // might have reached EOF while looking for the closing
>> bracket
>> +                // this can happen for malformed PDFs only. Make sure that
>> there is
>> +                // no endless loop.
>> +                if ( c < 0 )
>> +                {
>> +                    throw new IOException( "Missing closing bracket for hex
>> string. Reached EOS." );
>> +                }
>>                  
>>                   // exit loop
>>                   break;
> 
> 
> BR
> Andreas Lehmkühler

Reply via email to