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

"RangeError: Invalid typed array length: 59103" #66

Closed
nhoizey opened this issue Jun 11, 2021 · 4 comments
Closed

"RangeError: Invalid typed array length: 59103" #66

nhoizey opened this issue Jun 11, 2021 · 4 comments

Comments

@nhoizey
Copy link

nhoizey commented Jun 11, 2021

I'm using release 7.0.0 on Node.js 15.14.0.

It works very well with most photos (thanks! 🙏) , but when I try with one specific image, I get this error:

RangeError: Invalid typed array length: 59103
        at new Uint8Array (<anonymous>)
        at I.getUint8Array (/<project-path>/node_modules/exifr/dist/full.umd.js:1:3701)
        at I.getLatin1String (/<project-path>/node_modules/exifr/dist/full.umd.js:1:3866)
        at Mt.parse (/<project-path>/node_modules/exifr/dist/full.umd.js:1:72319)
        at /<project-path>/node_modules/exifr/dist/full.umd.js:1:12692
        at Array.map (<anonymous>)
        at ue.executeParsers (/<project-path>/node_modules/exifr/dist/full.umd.js:1:12663)
        at async ue.parse (/<project-path>/node_modules/exifr/dist/full.umd.js:1:12349)
        at async /<project-path>/_scripts/sync-photos.js:46:22

You can find the photo here:
https://github.com/nhoizey/nicolas-hoizey.photo/blob/main/src/photos/stairz/stairz.jpg

It works well on https://mutiny.cz/exifr/

I tried many different option settings.

It works with these

Everything but iptc

let exifrOptions = {
  iptc: false,
};

Only gps, full:

let exifrOptions = {
  ifd0: true,
  ifd1: true,
  exif: true,
  gps: true,
  iptc: false,
};

Only iptc, full:

let exifrOptions = {
  ifd0: false,
  ifd1: false,
  exif: false,
  gps: false,
  iptc: true,
};

Only iptc, without AudioType (but I still get AudioType in the result 🤷‍♂️):

let exifrOptions = {
  ifd0: false,
  ifd1: false,
  exif: false,
  gps: false,
  iptc: { skip: ['AudioType'] },
};

But I get the error with these

iptc, others default:

let exifrOptions = {
  iptc: true,
};

iptc and gps:

let exifrOptions = {
  ifd0: false,
  ifd1: false,
  exif: false,
  gps: true,
  iptc: true,
};

Everything:

let exifrOptions = {
  ifd0: true,
  ifd1: true,
  exif: true,
  gps: true,
  iptc: true,
};

It looks quite similar to #31 and #44

@MikeKovarik
Copy link
Owner

Hello. Wow, thank you for such a detailed info. It will be wonderful time debugging for a change. :D
I'll try to fix this ASAP since some other things already wait to be released, but I can't promise any date. Busy life. I'm sorry :(

@nhoizey
Copy link
Author

nhoizey commented Jun 13, 2021

@MikeKovarik don't be sorry at all, we all have busy lives and priorities. I do have some open source projects waiting for some time on my side!

I have an available workaround anyway, with two call to parse(), one for iptc and another for the other properties.

@MikeKovarik
Copy link
Owner

MikeKovarik commented Jul 1, 2021

Hello. I finally managed to get some time to dig into this. But I strangely couldn't replicate the problem. I tried inputting the file as both buffer and a path to trigger the different ways exifr parses file but unfortunately I couldn't replicate the problem with either options you provided.
I fixed similar issue #67 which i suppose was the root of your problem as well. But I tried your photo and instructions on the code before the fix but couldn't replicate the bug 😕.
I don't know. Could you try 7.1.1 7.1.2 and let me know if the #67 fix also fixed this for you? Thank you.

@nhoizey
Copy link
Author

nhoizey commented Jul 6, 2021

@MikeKovarik I upgraded to 7.1.2 and it now works perfectly! 👍🎉

@nhoizey nhoizey closed this as completed Jul 6, 2021
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