]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
http2: pass data through when decompression fails
authorPhilippe Antoine <contact@catenacyber.fr>
Mon, 5 Apr 2021 13:53:09 +0000 (15:53 +0200)
committerVictor Julien <victor@inliniac.net>
Mon, 7 Jun 2021 08:58:05 +0000 (10:58 +0200)
as is done for HTTP1

(cherry picked from commit 1ca4f041bb452742f326985479fca9a02473649f)

rust/src/http2/decompression.rs

index 205b527a1455ce72aee3be9fd4100e307f6aef1f..518a8e320170b7b7395eef211d44c7ec2b71d204 100644 (file)
@@ -172,10 +172,24 @@ impl HTTP2DecoderHalf {
     ) -> io::Result<&'a [u8]> {
         match self.decoder {
             HTTP2Decompresser::GZIP(ref mut gzip_decoder) => {
-                return http2_decompress(gzip_decoder, input, output);
+                let r = http2_decompress(gzip_decoder, input, output);
+                match r {
+                    Err(_) => {
+                        self.decoder = HTTP2Decompresser::UNASSIGNED;
+                    }
+                    _ => {}
+                }
+                return r;
             }
             HTTP2Decompresser::BROTLI(ref mut br_decoder) => {
-                return http2_decompress(br_decoder, input, output);
+                let r = http2_decompress(br_decoder, input, output);
+                match r {
+                    Err(_) => {
+                        self.decoder = HTTP2Decompresser::UNASSIGNED;
+                    }
+                    _ => {}
+                }
+                return r;
             }
             _ => {}
         }