Bug: it fails to satisfy the specification.
Integers have no size limitation.
Currently, node-bencode allows decoded integer data to be corrupted. It should either use bigints or throw on a long integer input.
| functiongetIntFromBuffer(buffer,start,end){ |
| letsum=0 |
| letsign=1 |
| |
| for(leti=start;i<end;i++){ |
| constnum=buffer[i] |
| |
| if(num<58&&num>=48){ |
| sum=sum*10+(num-48) |
| continue |
| } |
yourdecode("i9007199254740991e")===yourdecode("i9007199254740992e")
Bug: it fails to satisfy the specification.
Currently, node-bencode allows decoded integer data to be corrupted. It should either use
bigints or throw on a long integer input.node-bencode/lib/decode.js
Lines 18 to 28 in 2fa2c7e