pypdf icon indicating copy to clipboard operation
pypdf copied to clipboard

_read_inline_image got into infinite loop

Open yuvalgtrustmi opened this issue 1 year ago • 0 comments

_read_inline_image got into infinite loop.

I cannot share the pdf itself but I can say that it had images only in it. the issue is here:

`

       while True:
         # Read 8 kB at a time and check if the chunk contains the E operator.
        buf = stream.read(8192)
        # We have reached the end of the stream, but haven't found the EI operator.
        if not buf:
            raise PdfReadError("Unexpected end of stream")
       .....

` In my case "buf = stream.read(8192)" return only 2 bytes containing 'EI' which as far as I understand is the 'end image' mark. the rest of the code there will never break the 'while True' loop.

I will open a PR with possible fix.

thanks

yuvalgtrustmi avatar Jan 23 '24 17:01 yuvalgtrustmi