mariadb-corporation / mariadb-connector-nodejs

MariaDB Connector/Node.js is used to connect applications developed on Node.js to MariaDB and MySQL databases. MariaDB Connector/Node.js is LGPL licensed.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RangeError: readFloatLE hard crash

E-gy opened this issue · comments

commented

Error occurs when trying to execute a particular SELECT query.

Stack trace:

RangeError [ERR_OUT_OF_RANGE]: The value of "offset" is out of range. It must be >= 0 and <= 375. Received 537
  at new NodeError (node:internal/errors:363:5)
    at boundsError (node:internal/buffer:86:9)
    at Buffer.readFloatForwards [as readFloatLE] (node:internal/buffer:532:5)
    at PacketNodeEncoded.readFloat (node_modules\mariadb\lib\io\packet.js:432:26)
    at node_modules\mariadb\lib\cmd\column-definition.js:97:104
    at Execute.parseRowStdBinary (node_modules\mariadb\lib\cmd\parser.js:498:57)
    at Execute.readResultSetRow (node_modules\mariadb\lib\cmd\parser.js:399:29)
    at PacketInputStream.receivePacketBasic (node_modules\mariadb\lib\io\packet-input-stream.js:76:9)
    at PacketInputStream.onData (node_modules\mariadb\lib\io\packet-input-stream.js:139:20)
    at Socket.emit (node:events:394:28)

Tested on MariaDB version 3.0.0-3.0.2, Node 16, on both Windows and Linux (the above trace is from Win).

I haven't yet been able to discern the exact specificity of the query that causes the crash - it seems to be both related to the table and the data stored - as it crashes on particular column of particular row in particular table. As simple as it is the query in question returns a complete result set of a single item - it looks like this:

select stuff.pk as pk, stuff.a as a, stuff.b as b, ... from stuff_things stuff where (stuff.pk = ?) LIMIT 0,1

Running with query instead of execute simply returns undefined, with no errors whatsoever reported anywhere.

Finally and obviously, running the query in MySQL works as expected and returns the singled intended item correctly.

As a temporary fix, i'm returning the minimum columns required, which happen not to cause the crash, altho permanently it won't be possible to keep this behaviour due to service requirements.

Could you share the DDL of the table ? was there any TIME column in there ?

After checking code, this might be https://jira.mariadb.org/browse/CONJS-236

it will be corrected with 3.1.0 release (commit be84cc4 )