Prevent generating out-of-bounds distances in zlib

When a payload is compressed via zlib using a known-in-advance
dictionary symbols that are distant can cause the compression output
buffer to be overwritten.

This patch applies a fix that comes from upstream:
https://github.com/madler/zlib/commit/5c44459c3b28a9bd3283aaceab7c615f8020c531
That fix hasn't yet landed in the master branch.

This will prevent us from generating those invalid payloads.

BUG=874550

Change-Id: Ic421d7242450f866388c90cee67cbc48b92ed83c
Reviewed-on: https://chromium-review.googlesource.com/1176284
Commit-Queue: Chris Blume <cblume@chromium.org>
Reviewed-by: Will Harris <wfh@chromium.org>
Reviewed-by: Adenilson Cavalcanti <cavalcantii@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#583975}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 777b3763b4f45e4e10f6ff3c6cd46c6e086dc243
3 files changed