mirror of
https://github.com/unmojang/node-minecraft-protocol.git
synced 2025-09-29 06:03:33 -04:00
more decompression more reliable : ignore packet that cannot be decompressed
do print an error though, because servers should not send wrong packets mitigate #462
This commit is contained in:
parent
9778bb920b
commit
571d0e0c25
@ -52,7 +52,17 @@ class Decompressor extends Transform {
|
|||||||
return cb()
|
return cb()
|
||||||
} else {
|
} else {
|
||||||
zlib.inflate(chunk.slice(size), (err, newBuf) => {
|
zlib.inflate(chunk.slice(size), (err, newBuf) => {
|
||||||
if (err) { return cb(err) }
|
if (err) {
|
||||||
|
console.error('problem inflating chunk')
|
||||||
|
console.error('uncompressed length ' + value)
|
||||||
|
console.error('compressed length ' + chunk.length)
|
||||||
|
console.error('hex ' + chunk.toString('hex'))
|
||||||
|
console.log(err)
|
||||||
|
return cb()
|
||||||
|
}
|
||||||
|
if (newBuf.length !== value) {
|
||||||
|
console.error('uncompressed length should be ' + value + ' but is ' + newBuf.length)
|
||||||
|
}
|
||||||
this.push(newBuf)
|
this.push(newBuf)
|
||||||
return cb()
|
return cb()
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user