Questions about 'Decompress the payload'

#1

Hi all,

I have some trouble when testing my websocket server using the testcase 12.1.1. There is no problem when the server under test is from autobahn python library. I am not clear about the causes.

when the sec-websocket-extension is ‘permessage deflate’ in the extension negotiation response, the decompressor from zlib.decompressobj(-client_max_window_bits) can decompress the first two compressed frames (in the log)

RX compressed [18]: aae652505050722c2dc94f4accc80ba80400
RX compressed [18]: 2ac9c8cfd337d033d33350b252a8e6520000

However, for the third compressed message,
RX compressed [10]: 020325433d20040b0000,

The decompressor reports the error: Error -3 while decompressing: invalid distance too far back

To reproduce the above error:
import zlib
decompressor = zlib.decompressobj(-client_max_window_bits) # client_max_windows_bits is between 8 and 15
decompressor.decompress(b’\xaa\xe6RPPPr,-\xc9OJ\xcc\xc8\x0b\xa8\x04\x00’)

decompressor = zlib.decompressobj(-client_max_window_bits)
decompressor.decompress(b’*\xc9\xc8\xcf\xd37\xd03\xd33P\xb2R\xa8\xe6R\x00\x00’)

decompressor = zlib.decompressobj(-client_max_window_bits)
decompressor.decompress(b’\x02\x03%C= \x04\x0b\x00\x00’) # Error -3 while decompressing: invalid distance too far back

Thanks for reading and help.

0 Likes

#2

The decompressor reports the error: Error -3 while decompressing:
invalid distance too far back

This could be related to deflate window size and/or context takeover. Check what's being negotiated in the WebSocket handshake for these permessage-deflate parameters, and check your implementation for correct processing of these things ..

Hope this helps,
Tobias

0 Likes

#3

Hey,

Did you get any luck with this issue? I am getting the same thing here…

0 Likes