agentzh, thanks for the answer, seems the problem is really with zero size bufs. I changed code to insert spaces, if buffer is empty and everything start to work with gzip disabled (before that nothing worked with gzip off), and I think there will be no crashes in gzip now if enabled. Now I will create my own chains to pass to downstream filters.
I didn't try valgrind because usually it consumes a lot more cpu, and this is unacceptable on staging machine(there will be high cpu load, or I will need to decrease number of requests so I will wait for crash more time). But thanks for reminding about it.