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

Exception is thrown when reading tags from an image #248

Closed
zdila opened this issue Oct 1, 2023 · 5 comments
Closed

Exception is thrown when reading tags from an image #248

zdila opened this issue Oct 1, 2023 · 5 comments

Comments

@zdila
Copy link

zdila commented Oct 1, 2023

Description

Exception is thrown when reading tags from an image.

It seems to be caused by reading some thumbnail data. I' ve tried to disable thumbnails with custom exif configuration, but according to your webpack config the string replacement regex doesn't cover tags.js file (this should be fixed too).

Additional details

  • ExifReader version: 4.13.0
  • Web browser and version: 6.2.3105.51 (Stable channel) stable (64-bit)
  • Node version: v18.18.0

How to reproduce

  1. extract image from image.zip
  2. try to read tags

What I expected would happen:

Thags would be read.

What really happened:

Exception is thrown:

RangeError: Maximum call stack size exceeded
    at Object.getAsciiValue (types.js:47:1)
    at getTagValue (tags.js:324:1)
    at readTag (tags.js:268:1)
    at readIfd (tags.js:218:1)
    at readIfd (tags.js:233:1)
    at readIfd (tags.js:233:1)
    at readIfd (tags.js:233:1)
    at readIfd (tags.js:233:1)
    at readIfd (tags.js:233:1)
    at readIfd (tags.js:233:1)
mattiasw added a commit that referenced this issue Oct 1, 2023
tags.js use Constants.USE_THUMBNAIL but wasn't searched while replacing.

#248
mattiasw added a commit that referenced this issue Oct 1, 2023
tags.js use Constants.USE_THUMBNAIL but wasn't searched while replacing.

#248
@mattiasw
Copy link
Owner

mattiasw commented Oct 1, 2023

Hi! Thanks for the report. I've fixed the missing tags.js file in the replacement regex in the latest commit. If the other error is taking too long to fix I'll release that by itself in the meantime.

@mattiasw
Copy link
Owner

mattiasw commented Oct 3, 2023

Thumbnail exclusion fix released as version 4.13.1. I'll keep working on the real error. I have something that seems to work but need to understand why. 😅

@zdila
Copy link
Author

zdila commented Oct 4, 2023

Replacement now works but my setup actually reads source files directly so I had to add rule to my own webpack config:

{
        test: /\/exifreader\/src\/tags\.js$/,
        loader: 'string-replace-loader',
        options: {
          search: 'Constants.USE_THUMBNAIL',
          replace: 'false',
        },
      },

@mattiasw
Copy link
Owner

mattiasw commented Oct 4, 2023

That's a shame. There is a suggestion for helping with that situation and it would be a great addition but that will be some time in the future: #243

mattiasw added a commit that referenced this issue Oct 7, 2023
mattiasw added a commit that referenced this issue Oct 7, 2023
In some files in the wild, non-0th IFDs have a pointer to a next IFD
even though that should not be possible. Only the 0th IFD should have 
this pointer and it is used for 1st IFD which is a thumbnail.

In the specific case of #248 those invalid pointers also pointed to the
same IFDs that contained them which caused an infinite loop.

#248
@mattiasw
Copy link
Owner

mattiasw commented Oct 7, 2023

A real fix for this is now released as version 4.13.2. Thanks for reporting. After the fix another two of my test files produced thumbnails that the library hadn't found before.

@mattiasw mattiasw closed this as completed Oct 7, 2023
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

2 participants