Skip to content

Commit

Permalink
Fix rare case of UDP download failing to decompress.
Browse files Browse the repository at this point in the history
If inflate() produces exactly sizeof(buffer) output, progress may not be
possible if all input has been consumed. As per zlib usage example,
Z_BUF_ERROR must be ignored in this case.
  • Loading branch information
skullernet committed May 9, 2024
1 parent f81c27f commit b01ef62
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/client/download.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ static bool inflate_udp_download(byte *data, int size, int decompressed_size)
z->avail_out = sizeof(buffer);

ret = inflate(z, Z_SYNC_FLUSH);
if (ret != Z_OK && ret != Z_STREAM_END) {
if (ret != Z_OK && ret != Z_STREAM_END && ret != Z_BUF_ERROR) {
Com_EPrintf("[UDP] Error %d decompressing download\n", ret);
finish_udp_download(NULL);
return false;
Expand Down

0 comments on commit b01ef62

Please sign in to comment.