js-stellar-base icon indicating copy to clipboard operation
js-stellar-base copied to clipboard

xdr.TransactionHistoryResultEntry toXdr() causes out of range error

Open pieterjan84 opened this issue 3 years ago • 0 comments

Describe the bug Calling the toXdr() method on xdr.TransactionHistoryResultEntry can cause an out of range error.

What version are you on? stellar-base 8.1.0 nodejs 16

To Reproduce Steps to reproduce the behavior: https://gist.github.com/pieterjan84/e99aea29935308be1d935946bb33699f

Error:

RangeError [ERR_OUT_OF_RANGE]: The value of "offset" is out of range. It must be >= 0 and <= 65532. Received 65536
        at new NodeError (node:internal/errors:372:5)
        at boundsError (node:internal/buffer:86:9)
        at checkBounds (node:internal/buffer:55:5)
        at checkInt (node:internal/buffer:74:3)
        at writeU_Int32BE (node:internal/buffer:802:3)
        at Buffer.writeInt32BE (node:internal/buffer:890:10)
        at Cursor.write [as writeInt32BE] (/node_modules/js-xdr/lib/cursor.js:180:28)
        at Function.write (/node_modules/js-xdr/lib/hyper.js:46:10)
        at /node_modules/js-xdr/lib/struct.js:75:14
        at arrayEach (/node_modules/lodash/_arrayEach.js:15:9) {
      code: 'ERR_OUT_OF_RANGE'
    }

pieterjan84 avatar Aug 24 '22 07:08 pieterjan84