Daniel Becker has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/21271 )

Change subject: IMPALA-12986: Base64Encode fails if the 'out_len' output 
parameter is passed with certain values
......................................................................


Patch Set 2:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/21271/2/be/src/util/coding-util.cc
File be/src/util/coding-util.cc:

http://gerrit.cloudera.org:8080/#/c/21271/2/be/src/util/coding-util.cc@125
PS2, Line 125: bool Base64Encode(const char* in, int64_t in_len, int64_t 
out_max, char* out,
> What do you think about changing Base64* functions to use uint32_t* or size
I actually think we should use 'unsigned' because that's what sasl_encode64() 
uses. It's very ugly and error-prone to cast from an integer pointer to the 
other when the size of the original and destination types are different. Now I 
think the current error is also because of that: we cast int64_t* to unsigned* 
(32 bits in this case) and the called function will only write into the lower 4 
bytes, and if the upper 4 bytes are non-zero, the result will fail the check at 
L134 (*out_len != out_max - 1).



--
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: comment
Gerrit-Change-Id: I35ae59fc9b3280f89ea4f7d95d27d2f21751001f
Gerrit-Change-Number: 21271
Gerrit-PatchSet: 2
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]>
Gerrit-Comment-Date: Wed, 10 Apr 2024 13:58:37 +0000
Gerrit-HasComments: Yes

Reply via email to