pulviscriptor / agario-client

Node.js agar.io client implementation
MIT License
80 stars 43 forks source link

TypeError: value is out of bounds #180

Open mbm3 opened 8 years ago

mbm3 commented 8 years ago

Keep getting this error only on OVH vps, when I run the SAME script on my pc it doesnt show this error.

buffer.js:705 throw TypeError('value is out of bounds'); ^ TypeError: value is out of bounds at TypeError (<anonymous>) at checkInt (buffer.js:705:11) at Buffer.writeInt32LE (buffer.js:782:5) at Object.Client.moveTo (/root/Bot/node_modules/agario-client/agario-client.js:621:13) at Object.kosBot.recalculateTarget (/root/Bot/server.js:211:25) at null.<anonymous> (/root/Bot/server.js:118:25) at wrapper [as _onTimeout] (timers.js:261:14) at Timer.listOnTimeout [as ontimeout] (timers.js:112:15)

pulviscriptor commented 8 years ago

By looking at line 621 https://github.com/pulviscriptor/agario-client/blob/master/agario-client.js#L621 I can say that you do something like client.moveTo(999999999999999999999999,1) There is chance that agar changed coordinates from UInt32 to something other, but i can't look up ATM. Anybody else getting this crash in line 621?

mbm3 commented 8 years ago

https://gyazo.com/ae1ff35d95aba01c0c4cf2195e754799 another friend of mine getting the same issue.

pulviscriptor commented 8 years ago

I tested my theory, i replaced line 119 https://github.com/pulviscriptor/agario-client/blob/master/examples/basic.js#L119 with

client.moveTo(9999999999999999, candidate_ball.y); 

And i got exact same crash in line 621. You need to make sure that you calling client.moveTo() with coordinates higher or equal to 0 and lower than 2,147,483,647 Add check to your script like if(x < 0 || x > 2147483647 || y < 0 || y > 2147483647). To make this protection inside agario-client i need multiple reports that this is common mistake for peoples. Your report and your friend (who using your same script?) is first and only one.