[
https://issues.apache.org/jira/browse/KUDU-3647?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17934511#comment-17934511
]
ASF subversion and git services commented on KUDU-3647:
-------------------------------------------------------
Commit 4d20ea93600acdf64617ed648f274d236369ed44 in kudu's branch
refs/heads/branch-1.18.x from Alexey Serbin
[ https://gitbox.apache.org/repos/asf?p=kudu.git;h=4d20ea936 ]
KUDU-3647 more robust zlib wrapper code
This patch introduces much more robust error handling for both
zlib::{CompressLevel,Uncompress}() utility wrappers and fixes a few bugs
introduced along with other modifications in [1]. In addition, the code
now follows the documented API of zlib's inflate()/deflate() more
closely per docs [2] and example [3], while zlib::CompressLevel()
no longer allocates memory on the heap and uses a much smaller
stack-allocated buffer. It seems that using a larger heap-allocated
buffer inadvertently hid the improper usage of zlib's deflate() API.
This patch adds a few test scenarios to cover the main functionality
of zlib::CompressLevel() and zlib::Uncompress(), and also a few specific
conditions attributed to truncated and corrupted input data that's fed
to zlib::Uncompress().
[1] https://issues.apache.org/jira/browse/KUDU-3201
[2] https://zlib.net/zlib_how.html
[3] https://zlib.net/zpipe.c
Change-Id: I5babcaf0a07c284d44f16201aa765e277b6464d3
Reviewed-on: http://gerrit.cloudera.org:8080/22568
Reviewed-by: Abhishek Chennaka <[email protected]>
Tested-by: Alexey Serbin <[email protected]>
(cherry picked from commit 1733cfc5adaa27e361e2f2df25a8d8c12d8c8710)
Reviewed-on: http://gerrit.cloudera.org:8080/22608
Reviewed-by: Marton Greber <[email protected]>
> zlib::Uncompress() wrapper isn't robust enough to detect truncated input data
> -----------------------------------------------------------------------------
>
> Key: KUDU-3647
> URL: https://issues.apache.org/jira/browse/KUDU-3647
> Project: Kudu
> Issue Type: Bug
> Components: hms, master, server, util
> Affects Versions: 1.14.0, 1.15.0, 1.16.0, 1.17.0, 1.17.1
> Reporter: Alexey Serbin
> Priority: Major
>
> Along with modifications introduced with
> [KUDU-3201|https://issues.apache.org/jira/browse/KUDU-3201], there was an
> update on {{zlib::Uncompress(...)}} where the condition on continuing
> {{inflate(...)}} had changed. That leads to inability to detect truncated
> gzip data in some scenarios, e.g. something that {{DecodeBase64()}} produced
> prior fixing [KUDU-3646|https://issues.apache.org/jira/browse/KUDU-3646].
> The litmus test for that is
> {{HmsNotificationLogListenerTest.TestGzipEventDecoding}} in
> {{hms_notification_log_listener-test.cc}}.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)