From e3c7d168cf35c45e9a2e77fd0b7f5686bbcf00e7 Mon Sep 17 00:00:00 2001 From: Guiyanakuang Date: Tue, 2 Nov 2021 21:19:25 +0800 Subject: [PATCH 1/2] Fix TestDecompression.testLzoLong on Debian 11 --- c++/src/LzoDecompressor.cc | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/c++/src/LzoDecompressor.cc b/c++/src/LzoDecompressor.cc index d1ba183aeb..0c5b51fcb6 100644 --- a/c++/src/LzoDecompressor.cc +++ b/c++/src/LzoDecompressor.cc @@ -312,13 +312,11 @@ namespace orc { output += SIZE_OF_INT; matchAddress += increment32; - *reinterpret_cast(output) = - *reinterpret_cast(matchAddress); + memcpy(output, matchAddress, SIZE_OF_INT); output += SIZE_OF_INT; matchAddress -= decrement64; } else { - *reinterpret_cast(output) = - *reinterpret_cast(matchAddress); + memcpy(output, matchAddress, SIZE_OF_LONG); matchAddress += SIZE_OF_LONG; output += SIZE_OF_LONG; } @@ -329,8 +327,7 @@ namespace orc { } while (output < fastOutputLimit) { - *reinterpret_cast(output) = - *reinterpret_cast(matchAddress); + memcpy(output, matchAddress, SIZE_OF_LONG); matchAddress += SIZE_OF_LONG; output += SIZE_OF_LONG; } @@ -340,8 +337,7 @@ namespace orc { } } else { while (output < matchOutputLimit) { - *reinterpret_cast(output) = - *reinterpret_cast(matchAddress); + memcpy(output, matchAddress, SIZE_OF_LONG); matchAddress += SIZE_OF_LONG; output += SIZE_OF_LONG; } From 3d4cc3b73ade1d7bb6691313ab7c69d399be11c4 Mon Sep 17 00:00:00 2001 From: Guiyanakuang Date: Wed, 3 Nov 2021 12:59:04 +0800 Subject: [PATCH 2/2] Additional Fix --- c++/src/LzoDecompressor.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/c++/src/LzoDecompressor.cc b/c++/src/LzoDecompressor.cc index 0c5b51fcb6..21bf194fed 100644 --- a/c++/src/LzoDecompressor.cc +++ b/c++/src/LzoDecompressor.cc @@ -362,8 +362,7 @@ namespace orc { // fast copy. We may over-copy but there's enough room in input // and output to not overrun them do { - *reinterpret_cast(output) = - *reinterpret_cast(input); + memcpy(output, input, SIZE_OF_LONG); input += SIZE_OF_LONG; output += SIZE_OF_LONG; } while (output < literalOutputLimit);