Reviewer comments

This commit is contained in:
Yash Tibrewal 2020-05-12 11:13:38 -07:00
parent 516c2f591a
commit 17b6be1ed8
2 changed files with 4 additions and 6 deletions

View File

@ -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);

View File

@ -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));