Skip to content

Fix possible crash if file footer was corrupted - #1

Merged
Avogar merged 1 commit into
release-1.5.12from
fix-crash
Jan 25, 2022
Merged

Avogar merged 1 commit into
release-1.5.12from
fix-crash

Conversation

@Avogar

@Avogar Avogar commented Jan 25, 2022

Copy link
Copy Markdown
Member

Fix possible crash while reading a file with corrupted footer. ClickHouse/ClickHouse#33797

@Avogar
Avogar merged commit f9a393e into release-1.5.12 Jan 25, 2022
@Avogar
Avogar deleted the fix-crash branch January 27, 2022 10:43
Avogar pushed a commit that referenced this pull request Feb 28, 2023
This PR aims to build and test the C++ module on CLang12

Currently, the build fails with new warnings.

Manually built and tested.
```
$ make test-out
Test project /Users/william/orc/build
    Start 1: orc-test
1/2 Test #1: orc-test .........................   Passed    3.99 sec
    Start 2: tool-test
2/2 Test #2: tool-test ........................   Passed   11.96 sec

100% tests passed, 0 tests failed out of 2
```

Closes apache#718

Signed-off-by: William Hyun <william@apache.org>
Avogar pushed a commit that referenced this pull request Feb 28, 2023
### What changes were proposed in this pull request?

This PR aims the following.
- Use `Java 17` instead of `Java 17 EA`.
- Remove `Java 16` to save the community testing resources
- Recover GitHub Action CI by using `java17` profile.
- Disable dependency check on `hadoop-hdfs` of `shim` module

Note that there is a TODO (ORC-1003) which fails due to some `shaded` classes.
We will revisit that.

### Why are the changes needed?

Java 17 is finally available.

### How was this patch tested?

Pass the CIs with Java 17.

When we test manually, it passed like the following.
```
$ java -version
openjdk version "17" 2021-09-14 LTS
OpenJDK Runtime Environment Zulu17.28+13-CA (build 17+35-LTS)
OpenJDK 64-Bit Server VM Zulu17.28+13-CA (build 17+35-LTS, mixed mode, sharing)

...
Test project /Users/dongjoon/APACHE/orc-merge/build
    Start 1: orc-test
1/7 Test #1: orc-test .........................   Passed    3.41 sec
    Start 2: java-test
2/7 Test #2: java-test ........................   Passed   97.92 sec
    Start 3: java-tools-test
3/7 Test #3: java-tools-test ..................   Passed    0.11 sec
    Start 4: java-bench-gen-test
4/7 Test #4: java-bench-gen-test ..............   Passed    0.98 sec
    Start 5: java-bench-scan-test
5/7 Test #5: java-bench-scan-test .............   Passed    0.67 sec
    Start 6: java-bench-hive-test
6/7 Test #6: java-bench-hive-test .............   Passed   12.47 sec
    Start 7: tool-test
7/7 Test #7: tool-test ........................   Passed   10.02 sec

100% tests passed, 0 tests failed out of 7

Total Test time (real) = 125.58 sec
Built target test-out
```
Avogar pushed a commit that referenced this pull request Feb 28, 2023
### What changes were proposed in this pull request?

This PR aims to add a test coverage for Windows on GitHub Action additionally.

### Why are the changes needed?

This PR aims to replace `AppVeyor` with GitHub Action eventually.

**AS IS(AppVeyor)**

https://github.com/apache/orc/blob/ae660f3006cae145d0db7a897fd81fe94029c0b2/appveyor.yml#L18-L41

**THIS PR(GitHub Action)**

https://github.com/apache/orc/runs/4662857757?check_suite_focus=true

```
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe - skipped
-- compiler MSVC version 19.0.24245.0
...
Test project D:/a/orc/orc/build
    Start 1: orc-test
1/1 Test #1: orc-test .........................   Passed   61.99 sec
```

### How was this patch tested?

Pass the GitHub Action with newly add Windows job.
Avogar pushed a commit that referenced this pull request Feb 28, 2023
### What changes were proposed in this pull request?
This PR aims to add Febdora 37 Docker test.

### Why are the changes needed?
To improve test coverage.

### How was this patch tested?
Manually test on AMD64.
Note that ORC-762 still exists; protobuffer 2.5.0 only works on AMD64 and Apple silicon.

```
$ docker build -t apache/orc-dev:fedora37 fedora37
$ ./run-one.sh local fedora37 fedora37
...
Test project /root/build
    Start 1: orc-test
1/8 Test #1: orc-test .........................   Passed    5.35 sec
    Start 2: java-test
2/8 Test #2: java-test ........................   Passed  192.94 sec
    Start 3: java-tools-test
3/8 Test #3: java-tools-test ..................   Passed    0.14 sec
    Start 4: java-bench-gen-test
4/8 Test #4: java-bench-gen-test ..............   Passed    1.38 sec
    Start 5: java-bench-scan-test
5/8 Test #5: java-bench-scan-test .............   Passed    1.23 sec
    Start 6: java-bench-hive-test
6/8 Test #6: java-bench-hive-test .............   Passed   13.55 sec
    Start 7: java-bench-spark-test
7/8 Test #7: java-bench-spark-test ............   Passed    4.66 sec
    Start 8: tool-test
8/8 Test #8: tool-test ........................   Passed   10.70 sec

100% tests passed, 0 tests failed out of 8

Total Test time (real) = 229.97 sec
Built target test-out
Finished fedora37 at Wed Aug 17 13:10:33 PDT 2022
```

Closes apache#1224 from williamhyun/fedora37.

Authored-by: William Hyun <william@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit 8f2b610)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
Avogar pushed a commit that referenced this pull request Feb 28, 2023
### What changes were proposed in this pull request?
This PR aims to add Febdora 37 Docker test.

### Why are the changes needed?
To improve test coverage.

### How was this patch tested?
Manually test on AMD64.
Note that ORC-762 still exists; protobuffer 2.5.0 only works on AMD64 and Apple silicon.

```
$ docker build -t apache/orc-dev:fedora37 fedora37
$ ./run-one.sh local fedora37 fedora37
...
Test project /root/build
    Start 1: orc-test
1/8 Test #1: orc-test .........................   Passed    5.35 sec
    Start 2: java-test
2/8 Test #2: java-test ........................   Passed  192.94 sec
    Start 3: java-tools-test
3/8 Test #3: java-tools-test ..................   Passed    0.14 sec
    Start 4: java-bench-gen-test
4/8 Test #4: java-bench-gen-test ..............   Passed    1.38 sec
    Start 5: java-bench-scan-test
5/8 Test #5: java-bench-scan-test .............   Passed    1.23 sec
    Start 6: java-bench-hive-test
6/8 Test #6: java-bench-hive-test .............   Passed   13.55 sec
    Start 7: java-bench-spark-test
7/8 Test #7: java-bench-spark-test ............   Passed    4.66 sec
    Start 8: tool-test
8/8 Test #8: tool-test ........................   Passed   10.70 sec

100% tests passed, 0 tests failed out of 8

Total Test time (real) = 229.97 sec
Built target test-out
Finished fedora37 at Wed Aug 17 13:10:33 PDT 2022
```

Closes apache#1224 from williamhyun/fedora37.

Authored-by: William Hyun <william@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
al13n321 pushed a commit that referenced this pull request May 31, 2024
### What changes were proposed in this pull request?

This PR aims to add `Debian 12` Docker test.

### Why are the changes needed?

To improve the test coverage for the new Debian OS environment.

### How was this patch tested?

Run the docker tests.

```
$ cd docker
$ ./run-one.sh local ORC-1498 debian12
Started local run for ORC-1498 on debian12 at Tue Aug 29 23:50:19 PDT 2023
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
...
Java version: 17.0.8, vendor: Debian, runtime: /usr/lib/jvm/java-17-openjdk-arm64
...
Run CPack packaging tool...
CPack: Create package using TGZ
CPack: Install projects
CPack: - Run preinstall target for: ORC
CPack: - Install project: ORC []
CPack: Create package
CPack: - package: /root/build/ORC-2.0.0-SNAPSHOT-Linux.tar.gz generated.
Test project /root/build
    Start 1: orc-test
1/8 Test #1: orc-test .........................   Passed    4.61 sec
    Start 2: java-test
2/8 Test #2: java-test ........................   Passed  105.33 sec
    Start 3: java-tools-test
3/8 Test #3: java-tools-test ..................   Passed    0.08 sec
    Start 4: java-bench-gen-test
4/8 Test #4: java-bench-gen-test ..............   Passed    0.73 sec
    Start 5: java-bench-scan-test
5/8 Test #5: java-bench-scan-test .............   Passed    0.65 sec
    Start 6: java-bench-hive-test
6/8 Test #6: java-bench-hive-test .............   Passed   11.11 sec
    Start 7: java-bench-spark-test
7/8 Test #7: java-bench-spark-test ............   Passed    3.23 sec
    Start 8: tool-test
8/8 Test #8: tool-test ........................   Passed    6.70 sec

100% tests passed, 0 tests failed out of 8

Total Test time (real) = 132.45 sec
Built target test-out
Finished debian12 at Wed Aug 30 00:02:14 PDT 2023
```

Closes apache#1605 from dongjoon-hyun/ORC-1498.

Authored-by: Dongjoon Hyun <dongjoon@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
al13n321 pushed a commit that referenced this pull request May 31, 2024
### What changes were proposed in this pull request?

This PR aims to add `Ubuntu 24.04 LTS` Docker Test.

### Why are the changes needed?

Although the official `Ubuntu 24.04 LTS` will arrive on April 2024, we can start to track it from the official docker dev image.

- GNU C/CXX compiler: 13.2.0

### How was this patch tested?

Manual review.
```
$ ./reinit.sh ubuntu24
$ ./run-one.sh local ORC-1541 ubuntu24
...
Test project /root/build
    Start 1: orc-test
1/8 Test #1: orc-test .........................   Passed    4.53 sec
    Start 2: java-test
2/8 Test #2: java-test ........................   Passed  104.55 sec
    Start 3: java-tools-test
3/8 Test #3: java-tools-test ..................   Passed    0.07 sec
    Start 4: java-bench-gen-test
4/8 Test #4: java-bench-gen-test ..............   Passed    0.74 sec
    Start 5: java-bench-scan-test
5/8 Test #5: java-bench-scan-test .............   Passed    0.69 sec
    Start 6: java-bench-hive-test
6/8 Test #6: java-bench-hive-test .............   Passed   11.21 sec
    Start 7: java-bench-spark-test
7/8 Test #7: java-bench-spark-test ............   Passed    3.36 sec
    Start 8: tool-test
8/8 Test #8: tool-test ........................   Passed    6.94 sec

100% tests passed, 0 tests failed out of 8

Total Test time (real) = 132.08 sec
Built target test-out
Finished ubuntu24 at Fri Dec  8 23:34:01 PST 2023
```

This closes apache#1501 .

Closes apache#1679 from dongjoon-hyun/ORC-1541.

Authored-by: Dongjoon Hyun <dongjoon@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
al13n321 pushed a commit that referenced this pull request May 31, 2024
### What changes were proposed in this pull request?

This PR aims to simplify `fedora37` docker image for Apache ORC 2.0.
- Explicitly install Java 17
- Remove unused Java8 and Java 11 installation
- Remove unused Maven installation.

### Why are the changes needed?

The docker image is outdated.
- Java 8 and 11-related branches are not used at all.
- The installed Java 17 was due to the transitive dependency of `maven` installation.
- The installed `Maven` is not used because we use `mvnw`.

### How was this patch tested?

Manual tests.
```
$ ./run-one.sh local main fedora37
...
Test project /root/build
    Start 1: orc-test
1/8 Test #1: orc-test .........................   Passed    5.54 sec
    Start 2: java-test
2/8 Test #2: java-test ........................   Passed  118.00 sec
    Start 3: java-tools-test
3/8 Test #3: java-tools-test ..................   Passed    0.09 sec
    Start 4: java-bench-gen-test
4/8 Test #4: java-bench-gen-test ..............   Passed    0.83 sec
    Start 5: java-bench-scan-test
5/8 Test #5: java-bench-scan-test .............   Passed    0.74 sec
    Start 6: java-bench-hive-test
6/8 Test #6: java-bench-hive-test .............   Passed   11.28 sec
    Start 7: java-bench-spark-test
7/8 Test #7: java-bench-spark-test ............   Passed    3.49 sec
    Start 8: tool-test
8/8 Test #8: tool-test ........................   Passed    7.92 sec

100% tests passed, 0 tests failed out of 8

Total Test time (real) = 147.89 sec
Built target test-out
Finished fedora37 at Sat Dec 23 19:32:19 PST 2023
```

Closes apache#1694 from dongjoon-hyun/ORC-1555.

Authored-by: Dongjoon Hyun <dongjoon@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
al13n321 pushed a commit that referenced this pull request May 31, 2024
### What changes were proposed in this pull request?

This PR aims to add `Rocky Linux 9` Dockerfile.

### Why are the changes needed?

To provide a test coverage for `Oracle 9`-compatible OS environment.

- https://docs.rockylinux.org/release_notes/9_3/
- https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/9.3_release_notes/index

### How was this patch tested?

Manual test.

```
$ ./run-one.sh apache branch-1.9 rocky9
...
Test project /root/orc/build
    Start 1: orc-test
1/8 Test #1: orc-test .........................   Passed    4.92 sec
    Start 2: java-test
2/8 Test #2: java-test ........................   Passed  114.57 sec
    Start 3: java-tools-test
3/8 Test #3: java-tools-test ..................   Passed    0.07 sec
    Start 4: java-bench-gen-test
4/8 Test #4: java-bench-gen-test ..............   Passed    0.75 sec
    Start 5: java-bench-scan-test
5/8 Test #5: java-bench-scan-test .............   Passed    0.71 sec
    Start 6: java-bench-hive-test
6/8 Test #6: java-bench-hive-test .............   Passed   11.45 sec
    Start 7: java-bench-spark-test
7/8 Test #7: java-bench-spark-test ............   Passed    3.26 sec
    Start 8: tool-test
8/8 Test #8: tool-test ........................   Passed    6.70 sec

100% tests passed, 0 tests failed out of 8

Total Test time (real) = 142.44 sec
Built target test-out
Finished rocky9 at Sat Dec 23 23:21:18 PST 2023
```

Closes apache#1695 from dongjoon-hyun/ORC-1556.

Authored-by: Dongjoon Hyun <dongjoon@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
thevar1able pushed a commit that referenced this pull request Jun 6, 2025
### What changes were proposed in this pull request?
This PR aims to fix ZlibCodec decompression of damaged files can be fast fail.

### Why are the changes needed?

This is a long-standing issue. The decompress method implemented by ZlibCodec may enter an infinite loop when encountering some corrupt files.

jstack
```java
"main" #1 [4611] prio=5 os_prio=31 cpu=55921.47ms elapsed=57.53s tid=0x0000000139014600 nid=4611 runnable  [0x000000016d9fa000]
   java.lang.Thread.State: RUNNABLE
        at java.util.zip.Inflater.inflateBytesBytes(java.base21.0.5/Native Method)
        at java.util.zip.Inflater.inflate(java.base21.0.5/Inflater.java:376)
        - locked <0x00000004367befc0> (a java.util.zip.Inflater$InflaterZStreamRef)
        at org.apache.orc.impl.ZlibCodec.decompress(ZlibCodec.java:168)
        at org.apache.orc.impl.InStream$CompressedStream.readHeader(InStream.java:521)
        at org.apache.orc.impl.InStream$CompressedStream.ensureUncompressed(InStream.java:548)
        at org.apache.orc.impl.InStream$CompressedStream.read(InStream.java:535)
        at org.apache.orc.impl.TreeReaderFactory$BytesColumnVectorUtil.commonReadByteArrays(TreeReaderFactory.java:2052)        at org.apache.orc.impl.TreeReaderFactory$BytesColumnVectorUtil.readOrcByteArrays(TreeReaderFactory.java:2071)
        at org.apache.orc.impl.TreeReaderFactory$StringDirectTreeReader.nextVector(TreeReaderFactory.java:2169)
        at org.apache.orc.impl.TreeReaderFactory$StringTreeReader.nextVector(TreeReaderFactory.java:2001)
        at org.apache.orc.impl.reader.tree.StructBatchReader.readBatchColumn(StructBatchReader.java:65)
        at org.apache.orc.impl.reader.tree.StructBatchReader.nextBatchForLevel(StructBatchReader.java:100)
        at org.apache.orc.impl.reader.tree.StructBatchReader.nextBatch(StructBatchReader.java:77)
        at org.apache.orc.impl.RecordReaderImpl.nextBatch(RecordReaderImpl.java:1432)
        at org.apache.orc.tools.PrintData.printJsonData(PrintData.java:208)
        at org.apache.orc.tools.PrintData.main(PrintData.java:288)
        at org.apache.orc.tools.Driver.main(Driver.java:120)
```

### How was this patch tested?
1. local test
2. Add UT

### Was this patch authored or co-authored using generative AI tooling?
No

Closes apache#2127 from cxzl25/zlib_infinite_loop.

Authored-by: sychen <sychen@ctrip.com>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit 8eaf92d)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
taiyang-li pushed a commit to taiyang-li/orc that referenced this pull request Jul 8, 2025
### What changes were proposed in this pull request?
This PR aims to fix ZlibCodec decompression of damaged files can be fast fail.

### Why are the changes needed?

This is a long-standing issue. The decompress method implemented by ZlibCodec may enter an infinite loop when encountering some corrupt files.

jstack
```java
"main" ClickHouse#1 [4611] prio=5 os_prio=31 cpu=55921.47ms elapsed=57.53s tid=0x0000000139014600 nid=4611 runnable  [0x000000016d9fa000]
   java.lang.Thread.State: RUNNABLE
        at java.util.zip.Inflater.inflateBytesBytes(java.base21.0.5/Native Method)
        at java.util.zip.Inflater.inflate(java.base21.0.5/Inflater.java:376)
        - locked <0x00000004367befc0> (a java.util.zip.Inflater$InflaterZStreamRef)
        at org.apache.orc.impl.ZlibCodec.decompress(ZlibCodec.java:168)
        at org.apache.orc.impl.InStream$CompressedStream.readHeader(InStream.java:521)
        at org.apache.orc.impl.InStream$CompressedStream.ensureUncompressed(InStream.java:548)
        at org.apache.orc.impl.InStream$CompressedStream.read(InStream.java:535)
        at org.apache.orc.impl.TreeReaderFactory$BytesColumnVectorUtil.commonReadByteArrays(TreeReaderFactory.java:2052)        at org.apache.orc.impl.TreeReaderFactory$BytesColumnVectorUtil.readOrcByteArrays(TreeReaderFactory.java:2071)
        at org.apache.orc.impl.TreeReaderFactory$StringDirectTreeReader.nextVector(TreeReaderFactory.java:2169)
        at org.apache.orc.impl.TreeReaderFactory$StringTreeReader.nextVector(TreeReaderFactory.java:2001)
        at org.apache.orc.impl.reader.tree.StructBatchReader.readBatchColumn(StructBatchReader.java:65)
        at org.apache.orc.impl.reader.tree.StructBatchReader.nextBatchForLevel(StructBatchReader.java:100)
        at org.apache.orc.impl.reader.tree.StructBatchReader.nextBatch(StructBatchReader.java:77)
        at org.apache.orc.impl.RecordReaderImpl.nextBatch(RecordReaderImpl.java:1432)
        at org.apache.orc.tools.PrintData.printJsonData(PrintData.java:208)
        at org.apache.orc.tools.PrintData.main(PrintData.java:288)
        at org.apache.orc.tools.Driver.main(Driver.java:120)
```

### How was this patch tested?
1. local test
2. Add UT

### Was this patch authored or co-authored using generative AI tooling?
No

Closes apache#2127 from cxzl25/zlib_infinite_loop.

Authored-by: sychen <sychen@ctrip.com>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant