Reviewer comments

pull/22929/head
Yash Tibrewal 5 years ago
parent 516c2f591a
commit 17b6be1ed8
  1. 2
      src/core/lib/compression/message_compress.cc
  2. 8
      test/core/compression/message_compress_test.cc

@ -34,7 +34,7 @@
static int zlib_body(z_stream* zs, grpc_slice_buffer* input,
grpc_slice_buffer* output,
int (*flate)(z_stream* zs, int flush)) {
int r;
int r = Z_OK;
int flush;
size_t i;
grpc_slice outbuf = GRPC_SLICE_MALLOC(OUTPUT_BLOCK_SIZE);

@ -210,12 +210,10 @@ static void test_bad_decompression_data_missing_trailer(void) {
grpc_core::ExecCtx exec_ctx;
/* compress it */
grpc_msg_compress(GRPC_MESSAGE_COMPRESS_GZIP, &input, &corrupted);
/* corrupt the output by smashing the CRC */
GPR_ASSERT(corrupted.count > 1);
GPR_ASSERT(GRPC_SLICE_LENGTH(corrupted.slices[1]) > 8);
GPR_ASSERT(GRPC_SLICE_LENGTH(corrupted.slices[corrupted.count - 1]) > 8);
/* Remove the footer by manipulating the slice length */
corrupted.slices[1].data.refcounted.length -= 8;
/* try (and fail) to decompress the corrupted compresed buffer */
/* try (and fail) to decompress the compressed buffer without the footer */
GPR_ASSERT(0 == grpc_msg_decompress(GRPC_MESSAGE_COMPRESS_GZIP, &corrupted,
&output));

Loading…
Cancel
Save