royale-proxy / node-cr-proxy

A simple Clash Royale proxy, implementing the new encryption, built on top of Node
GNU Lesser General Public License v3.0
36 stars 13 forks source link

Out of bounds error #2

Open tarik02 opened 7 years ago

tarik02 commented 7 years ago

I got error. Stack:

TypeError: "value" argument is out of bounds
    at checkInt (buffer.js:1039:11)
    at Buffer.writeInt16LE (buffer.js:1207:5)
    at Nonce.increment (/home/tarik02/work/programming/clashroyale/node-cr-proxy/lib/nonce.js:30:21)
    at ServerCrypto.decrypt (/home/tarik02/work/programming/clashroyale/node-cr-proxy/lib/crypto.js:67:31)
    at ServerCrypto.decryptPacket (/home/tarik02/work/programming/clashroyale/node-cr-proxy/lib/server/crypto.js:43:38)
    at /home/tarik02/work/programming/clashroyale/node-cr-proxy/index.js:128:30
    at PacketReceiver.packetize (/home/tarik02/work/programming/clashroyale/node-cr-proxy/lib/packetreceiver.js:29:21)
    at Socket.<anonymous> (/home/tarik02/work/programming/clashroyale/node-cr-proxy/index.js:118:34)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
srabouin commented 7 years ago

Was the proxy running for a very long time / a lot of messages? I think at some point the nonce is too big.

tarik02 commented 7 years ago

No, proxy was running for one-three minutes, there are not so many messages. I think that solution is to add value = value % Int16Max.

ghost commented 7 years ago

Which line does that occur on?

tarik02 commented 7 years ago

@Batch-Monger, home/tarik02/work/programming/clashroyale/node-cr-proxy/lib/nonce.js:30:21