I manage a MySQL DB with geospatial data stored in a table. When I query the data from node.js, some of the records are returned with geodata parsed as expected, but nearly 40% of the records are casting the following error (with different values of offset) :
---
RangeError [ERR_OUT_OF_RANGE]: The value of "offset" is out of range. It must be >= 0 and <= 5254. Received 5261
at new NodeError (node:internal/errors:371:5)
at boundsError (node:internal/buffer:86:9)
at Buffer.readDoubleForwards [as readDoubleLE] (node:internal/buffer:564:5)
at parseGeometry (/var/www/api-mountain/v2/node_modules/mysql/lib/protocol/Parser.js:309:38)
at Parser.parseGeometryValue (/var/www/api-mountain/v2/node_modules/mysql/lib/protocol/Parser.js:341:10)
at RowDataPacket.typeCast (/var/www/api-mountain/v2/node_modules/mysql/lib/protocol/packets/RowDataPacket.js:118:21)
at RowDataPacket.parse (/var/www/api-mountain/v2/node_modules/mysql/lib/protocol/packets/RowDataPacket.js:36:16)
at Query.RowDataPacket (/var/www/api-mountain/v2/node_modules/mysql/lib/protocol/sequences/Query.js:153:10)
at Protocol._parsePacket (/var/www/api-mountain/v2/node_modules/mysql/lib/protocol/Protocol.js:260:14)
at Parser._parsePacket (/var/www/api-mountain/v2/node_modules/mysql/lib/protocol/Parser.js:433:10)
---
It seems that the geometry parser of mysql lib fails to calculate the buffer offset in some cases and returns an offset outise the buffer length.
I'm not expreimented enough to debug this issue, so I hope you can have a look at it.
I'm waiting for more information about versions and system being used.
I'm opening the issue on behalf of Marc Delpont:
I'm waiting for more information about versions and system being used.