You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2023/01/30 13:17:54 UTC
[doris-thirdparty] branch libhdfs3 updated: [Fix](libhdfs3) Fix seek(0) does not reset stream offset of CryptoCodec. (#35)
This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch libhdfs3
in repository https://gitbox.apache.org/repos/asf/doris-thirdparty.git
The following commit(s) were added to refs/heads/libhdfs3 by this push:
new d1a9e2a [Fix](libhdfs3) Fix seek(0) does not reset stream offset of CryptoCodec. (#35)
d1a9e2a is described below
commit d1a9e2a9c17245c469fdb5a4132c43977def1a92
Author: Qi Chen <ka...@gmail.com>
AuthorDate: Mon Jan 30 21:17:48 2023 +0800
[Fix](libhdfs3) Fix seek(0) does not reset stream offset of CryptoCodec. (#35)
---
src/client/CryptoCodec.cpp | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/client/CryptoCodec.cpp b/src/client/CryptoCodec.cpp
index c8dadb8..800344e 100644
--- a/src/client/CryptoCodec.cpp
+++ b/src/client/CryptoCodec.cpp
@@ -23,6 +23,8 @@
#include "CryptoCodec.h"
#include "Logger.h"
+#include <inttypes.h>
+
using namespace Hdfs::Internal;
@@ -142,7 +144,14 @@ namespace Hdfs {
counter = stream_offset / 16;
padding = stream_offset % 16;
iv = this->calculateIV(iv, counter);
- }
+ } else if (stream_offset == 0) {
+ counter = 0;
+ padding = 0;
+ } else {
+ LOG(WARNING, "CryptoCodec : Invalid stream_offset %" PRId64, stream_offset);
+ return -1;
+
+ }
// Judge the crypto method is encrypt or decrypt.
int enc = (method == CryptoMethod::ENCRYPT) ? 1 : 0;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org