Daniel Becker has uploaded this change for review. ( 
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 negative
value or 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 success of this function shouldn't depend on the value of '*out_len'
because it is an output parameter, so this change sets '*out_len' to
zero before passing it to sasl_encode64().

Testing:
 - added a regression test in coding-util-test.cc

Change-Id: I35ae59fc9b3280f89ea4f7d95d27d2f21751001f
---
M be/src/util/coding-util-test.cc
M be/src/util/coding-util.cc
M be/src/util/coding-util.h
3 files changed, 32 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/71/21271/2
--
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: newchange
Gerrit-Change-Id: I35ae59fc9b3280f89ea4f7d95d27d2f21751001f
Gerrit-Change-Number: 21271
Gerrit-PatchSet: 2
Gerrit-Owner: Daniel Becker <[email protected]>
Gerrit-Reviewer: Noemi Pap-Takacs <[email protected]>
Gerrit-Reviewer: Peter Rozsa <[email protected]>
Gerrit-Reviewer: Zoltan Borok-Nagy <[email protected]>

Reply via email to