Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexError: list index out of range in export_image function when accessing filters[-1][0] due to an empty or improperly structured filters list. #1052

Open
vanshika-panwar opened this issue Oct 21, 2024 · 0 comments

Comments

@vanshika-panwar
Copy link

Bug report

  • encountered an IndexError in the export_image function of pdfminer, specifically in this line:
    if filters[-1][0] in LITERALS_DCT_DECODE:
  • The error occurs when attempting to access filters[-1][0], which fails when filters is either empty or not structured as expected. Please investigate if there should be additional checks to handle these cases gracefully.

Traceback

Traceback (most recent call last):\n File "/usr/src/python-app/processor/pdf_processor.py", line 114, in __get_image_raw_data\n file_name = image_writer.export_image(image=image)\n File "/opt/conda/envs/env/lib/python3.9/site-packages/pdfminer/image.py", line 108, in export_image\n if filters[-1][0] in LITERALS_DCT_DECODE:\nIndexError: list index out of range

Screenshot 2024-10-21 at 11 08 47 AM

attaching the pdf used
vietnam.pdf

@pietermarsman please review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@vanshika-panwar and others