Impala Public Jenkins has submitted this change and it was merged. (
http://gerrit.cloudera.org:8080/21271 )
Change subject: IMPALA-12986: Base64Encode fails if the 'out_len' output
parameter is passed with certain values
......................................................................
IMPALA-12986: Base64Encode fails if the 'out_len' output parameter is passed
with certain values
The Base64Encode function in coding-util.h with signature
bool Base64Encode(const char* in, int64_t in_len, int64_t out_max,
char* out, int64_t* out_len);
fails if '*out_len', when passed to the function, contains a value that
does not fit in a 32 bit integer.
Internally we use the
int sasl_encode64(const char *in, unsigned inlen, char *out, unsigned
outmax, unsigned *outlen);
function and explicitly cast 'out_len' to 'unsigned*'.
The error is that the called sasl_encode64() function only sets the four
lower bytes of '*out_len' (assuming that 'unsigned' is a 32 bit
integer), and if the upper bytes are not all zero, the resulting value
of '*out_len' will be incorrect.
This change changes the type of 'out_len' from 'int64_t*' to 'unsigned*'
to match the type that sasl_encode64() expects.
Base64Decode() is also updated to use 'unsigned*'. Before this change it
used an intermediate 32 bit local variable to avoid this issue.
Testing:
- added a regression test in coding-util-test.cc
Change-Id: I35ae59fc9b3280f89ea4f7d95d27d2f21751001f
Reviewed-on: http://gerrit.cloudera.org:8080/21271
Reviewed-by: Impala Public Jenkins <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>
---
M be/src/exec/text-converter.inline.h
M be/src/exprs/string-functions-ir.cc
M be/src/util/coding-util-test.cc
M be/src/util/coding-util.cc
M be/src/util/coding-util.h
M be/src/util/runtime-profile.cc
6 files changed, 43 insertions(+), 16 deletions(-)
Approvals:
Impala Public Jenkins: Looks good to me, approved; Verified
--
To view, visit http://gerrit.cloudera.org:8080/21271
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I35ae59fc9b3280f89ea4f7d95d27d2f21751001f
Gerrit-Change-Number: 21271
Gerrit-PatchSet: 5
Gerrit-Owner: Daniel Becker <[email protected]>
Gerrit-Reviewer: Daniel Becker <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Noemi Pap-Takacs <[email protected]>
Gerrit-Reviewer: Peter Rozsa <[email protected]>
Gerrit-Reviewer: Zoltan Borok-Nagy <[email protected]>