Closed TonyTNguyen closed 2 years ago
file is attached for posterity, ok let me look into this ipra_dresden_03.zip
ok see #101 basically it was actually more then just the file being too long, there was a cutoff record that started before the file was supposed to end
fixed in 4.0.2
I understand that the shape file has to be compliant with the specification, but once a while, I think a little tolerance won't hurt. My case is the file https://ufile.io/ekyn4 (file valid only 30 days from 8/2/2018) I debug the latest shp.js, and open the .shp file with the hex editor, and find out that the header say the file size should be 652 bytes, but the actual size is 656 bytes. So it trips on checkOffset(offset, ext, length) inside readInt32BE(), when the offset === 652 of ParseShp.prototype.getRow = function(offset) {...} view return on "var view = this.buffer.slice(offset, offset + 12);" only 4 bytes, so the next line var len = view.readInt32BE(4) << 1; will raise error inside readInt32BE().
There is function ParseShp.prototype.parseHeader that will able to to return the length that we need. We can use that while advance the buffer inside of ParseShp.prototype.getRows() instead rely on the size of the buffer. Then we can be tolerance when the actual size is larger that stated size is.