geotiffjs / geotiff.js

geotiff.js is a small library to parse TIFF files for visualization or analysis. It is written in pure JavaScript, and is usable in both the browser and node.js applications.
https://geotiffjs.github.io/
MIT License
859 stars 179 forks source link

TypeError: Cannot read properties of undefined (reading 'offset') #374

Open altundag opened 1 year ago

altundag commented 1 year ago

Hello,

I get the following error when I try to load ce24e6fd-d4aa-4922-a91b-06c327a5c99b.tiff:

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'offset')
    at blockedsource.js:271:29
    at Array.map (<anonymous>)
    at BlockedSource.readSliceData (blockedsource.js:259:19)
    at BlockedSource._callee$ (blockedsource.js:160:17)
    at tryCatch (blockedsource.js:2:1)
    at Generator.<anonymous> (blockedsource.js:2:1)
    at Generator.next (blockedsource.js:2:1)
    at asyncGeneratorStep (blockedsource.js:2:1)
    at _next (blockedsource.js:2:1)

The version that I am using is v2.0.7. Here is a code snippet to reproduce the issue:

let tiff = await GeoTIFF.fromUrl("./data/ce24e6fd-d4aa-4922-a91b-06c327a5c99b.tiff");

// throws """TypeError: Cannot read properties of undefined (reading 'offset')"""
let ifd = await tiff.requestIFD(0);

I am not 100% sure, but the current < top condition here might be the cause (should it be current <= top?). Could you please help me fix the issue?

The following issues might be related to this one:

zipporaSay commented 1 year ago

I met the problem too

wtlovzjj commented 1 year ago

V2.0.7 still has this bug

altundag commented 11 months ago

I created pull request #394 to implement the proposed fix. Please review it.