Skip to content

Commit 31ca29e

Browse files
committed
IMPORT: slz: fix header used for empty zlib message
Calling slz_rfc1950_finish() without emitting any data would result in incorrectly emitting a gzip header (rfc1952) instead of a zlib header (rfc1950) due to a copy-paste between the two wrappers. The impact is almost inexistent since the zlib format is almost never used in this context, and compressing totally empty messages is quite rare as well. Let's take this opportunity for fixing another mistake on an RFC number in a comment. This is slz upstream commit 7f3fce4f33e8c2f5e1051a32a6bca58e32d4f818.
1 parent 411b04c commit 31ca29e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/slz.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,7 +1357,7 @@ long slz_rfc1950_encode(struct slz_stream *strm, unsigned char *out, const unsig
13571357
return ret;
13581358
}
13591359

1360-
/* Initializes stream <strm> for use with the zlib format (rfc1952). The
1360+
/* Initializes stream <strm> for use with the zlib format (rfc1950). The
13611361
* compression level passed in <level> is set. This value can only be 0 (no
13621362
* compression) or 1 (compression) and other values will lead to unpredictable
13631363
* behaviour. The function always returns 0.
@@ -1409,7 +1409,7 @@ int slz_rfc1950_finish(struct slz_stream *strm, unsigned char *buf)
14091409
strm->outbuf = buf;
14101410

14111411
if (__builtin_expect(strm->state == SLZ_ST_INIT, 0))
1412-
strm->outbuf += slz_rfc1952_send_header(strm, strm->outbuf);
1412+
strm->outbuf += slz_rfc1950_send_header(strm, strm->outbuf);
14131413

14141414
slz_rfc1951_finish(strm, strm->outbuf);
14151415
copy_8b(strm, (strm->crc32 >> 24) & 0xff);

0 commit comments

Comments
 (0)