summaryrefslogtreecommitdiff
path: root/inflate.c
diff options
context:
space:
mode:
authorIlya Leoshkevich <iii@linux.ibm.com>2020-09-28 21:21:49 +0200
committerHans Kristian Rosbach <hk-github@circlestorm.org>2020-10-09 11:35:23 +0200
commitbc5b9b24ef8d2178fd551d4e47a9b6ca85a97343 (patch)
tree0b55dd5834cb812db244f4670068ee4a6d481ff5 /inflate.c
parent05d4a0857a1ac57287af01d0007cdb1ac05e2b29 (diff)
Fix incorrect inflateSyncPoint() return value with DFLTCC
DFLTCC does not provide the necessary information to implement inflateSyncPoint() - Incomplete-Function Status and Incomplete-Function Length are the fields that provide the relevant information, but unfortunately it's not enough. If DFLTCC is in use, the current code checks software decompression state and always returns 0. This (rightfully) confuses rsync, so fix by returning Z_STREAM_ERROR instead.
Diffstat (limited to 'inflate.c')
-rw-r--r--inflate.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/inflate.c b/inflate.c
index 96f7443..3d5efbd 100644
--- a/inflate.c
+++ b/inflate.c
@@ -35,6 +35,8 @@
# define INFLATE_NEED_UPDATEWINDOW(strm) 1
/* Invoked at the beginning of inflateMark(). Useful for updating arch-specific pointers and offsets. */
# define INFLATE_MARK_HOOK(strm) do {} while (0)
+/* Invoked at the beginning of inflateSyncPoint(). Useful for performing arch-specific state checks. */
+#define INFLATE_SYNC_POINT_HOOK(strm) do {} while (0)
#endif
/* function prototypes */
@@ -1254,6 +1256,7 @@ int32_t Z_EXPORT PREFIX(inflateSyncPoint)(PREFIX3(stream) *strm) {
if (inflateStateCheck(strm))
return Z_STREAM_ERROR;
+ INFLATE_SYNC_POINT_HOOK(strm);
state = (struct inflate_state *)strm->state;
return state->mode == STORED && state->bits == 0;
}