team-ljyzipelo

공개

Merge pull request #119 from Team-LJY/features/tar-bz2-xz

TAR.BZ2와 TAR.XZ 작업자 해제 지원 추가
작성자
LeeJunyoung
작성 시각
커밋
326fe51fff2e6c7873399949aa514cae7c5d6d73
이 시점의 파일 보기

변경된 파일 26개

+1,720-73
수정docs/ui-design-v0.1.md+1-1
@@ -269,7 +269,7 @@
269269
270270고정 문구:
271271
272삭제: - 빈 화면: "압축파일을 여기에 끌어 놓으세요", "또는", "ZIP, 7z, TAR, GZ, TAR.GZ 파일을 열 수 있습니다", "놓으면 엽니다"
272추가: - 빈 화면: "압축파일을 여기에 끌어 놓으세요", "또는", "ZIP, 7z, TAR, GZ, TAR.GZ, TAR.BZ2, TAR.XZ 파일을 열 수 있습니다", "놓으면 엽니다"
273273- 닫기 확인 창 "작업 중 닫기": "작업을 취소하고 닫을까요?", 버튼 [계속 작업]과 [취소하고 닫기]
274274- "종료 확인 중" 창: "마무리하는 중입니다. 잠시만 기다려 주세요", 버튼 [닫기 취소]
275275
수정docs/ui-scenario-guide.md+4-0
@@ -42,6 +42,8 @@ cargo +1.99.1 build --locked --manifest-path experiments/rust-ui-memory-app/Carg
4242## 상황과 확인할 점
4343
4444- empty: 빈 첫 화면. 파일 열기 안내와 툴바 배치를 확인한다.
45추가: - tar-bz2: TAR.BZ2 목록. 제목표시줄의 파일 이름과 목록을 확인한다.
46추가: - tar-xz: TAR.XZ 목록. 제목표시줄의 대소문자가 섞인 복합 확장자와 목록을 확인한다.
4547- archive: 파일과 폴더가 있는 압축파일. 이름, 크기, 잠금 아이콘과 상태 줄을 확인한다.
4648- folder: 사진 폴더 내부. 상위 폴더 이동과 경로 줄을 확인한다.
4749- many-items: 기본 5개 외에 500개 파일을 추가한 목록. 스크롤바와 행 배치를 확인한다.
@@ -93,3 +95,5 @@ python3 tests/ci/run_rust.py local
9395
9496화면에 새 창, 버튼, 메시지, 상태 또는 오류를 추가하거나 바꾸면 같은 PR에서 상황, 시험과 이 가이드를 갱신한다. 화면 변화가 없으면 PR 본문에 "UI 변경 없음"이라고 적는다. 사용자가 직접 올린 UI 변경에서 빠진 상황은 병합 뒤 프론트엔드 담당이 보완한다.
9597
98추가:
99추가: TAR.BZ2와 TAR.XZ의 자동 해제 폴더 이름은 미리보기에 표시되지 않는다. tests/rust-app-ui/presentation.rs의 이름 시험과 tests/rust-app-real-worker/compressed_tar_flows.rs의 실제 작업자 시험에서 복합 확장자 제거와 해제 결과를 확인한다.
수정experiments/rust-archive-worker/Cargo.lock+101-11
@@ -10,7 +10,7 @@ checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0"
1010dependencies = [
1111 "cfg-if",
1212 "cipher",
13삭제: "cpufeatures",
13추가: "cpufeatures 0.2.17",
1414 "zeroize",
1515]
1616
@@ -23,6 +23,24 @@ dependencies = [
2323 "generic-array",
2424]
2525
26추가: [[package]]
27추가: name = "block-buffer"
28추가: version = "0.12.1"
29추가: source = "registry+https://github.com/rust-lang/crates.io-index"
30추가: checksum = "d2f6c7dbe95a6ed67ad9f18e57daf93a2f034c524b99fd2b76d18fdfeb6660aa"
31추가: dependencies = [
32추가: "hybrid-array",
33추가: ]
34추가:
35추가: [[package]]
36추가: name = "bzip2"
37추가: version = "0.6.1"
38추가: source = "registry+https://github.com/rust-lang/crates.io-index"
39추가: checksum = "f3a53fac24f34a81bc9954b5d6cfce0c21e18ec6959f44f56e8e90e4bb7c346c"
40추가: dependencies = [
41추가: "libbz2-rs-sys",
42추가: ]
43추가:
2644[[package]]
2745name = "cfg-if"
2846version = "1.0.5"
@@ -35,10 +53,16 @@ version = "0.4.4"
3553source = "registry+https://github.com/rust-lang/crates.io-index"
3654checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"
3755dependencies = [
38삭제: "crypto-common",
56추가: "crypto-common 0.1.7",
3957 "inout",
4058]
4159
60추가: [[package]]
61추가: name = "const-oid"
62추가: version = "0.10.3"
63추가: source = "registry+https://github.com/rust-lang/crates.io-index"
64추가: checksum = "be95d4a884358a21a199689323c29e9256b4a1b315e22f183d155422041d3a9a"
65추가:
4266[[package]]
4367name = "cpufeatures"
4468version = "0.2.17"
@@ -48,6 +72,15 @@ dependencies = [
4872 "libc",
4973]
5074
75추가: [[package]]
76추가: name = "cpufeatures"
77추가: version = "0.3.1"
78추가: source = "registry+https://github.com/rust-lang/crates.io-index"
79추가: checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566"
80추가: dependencies = [
81추가: "libc",
82추가: ]
83추가:
5184[[package]]
5285name = "crypto-common"
5386version = "0.1.7"
@@ -58,17 +91,37 @@ dependencies = [
5891 "typenum",
5992]
6093
94추가: [[package]]
95추가: name = "crypto-common"
96추가: version = "0.2.2"
97추가: source = "registry+https://github.com/rust-lang/crates.io-index"
98추가: checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453"
99추가: dependencies = [
100추가: "hybrid-array",
101추가: ]
102추가:
61103[[package]]
62104name = "digest"
63105version = "0.10.7"
64106source = "registry+https://github.com/rust-lang/crates.io-index"
65107checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
66108dependencies = [
67삭제: "block-buffer",
68삭제: "crypto-common",
109추가: "block-buffer 0.10.4",
110추가: "crypto-common 0.1.7",
69111 "subtle",
70112]
71113
114추가: [[package]]
115추가: name = "digest"
116추가: version = "0.11.3"
117추가: source = "registry+https://github.com/rust-lang/crates.io-index"
118추가: checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2"
119추가: dependencies = [
120추가: "block-buffer 0.12.1",
121추가: "const-oid",
122추가: "crypto-common 0.2.2",
123추가: ]
124추가:
72125[[package]]
73126name = "generic-array"
74127version = "0.14.7"
@@ -85,7 +138,16 @@ version = "0.12.1"
85138source = "registry+https://github.com/rust-lang/crates.io-index"
86139checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"
87140dependencies = [
88삭제: "digest",
141추가: "digest 0.10.7",
142추가: ]
143추가:
144추가: [[package]]
145추가: name = "hybrid-array"
146추가: version = "0.4.15"
147추가: source = "registry+https://github.com/rust-lang/crates.io-index"
148추가: checksum = "27f864f10dfb56725ce5ce5472bc52252c8f93a4ab86327122cebf62c5f59a17"
149추가: dependencies = [
150추가: "typenum",
89151]
90152
91153[[package]]
@@ -97,19 +159,34 @@ dependencies = [
97159 "generic-array",
98160]
99161
162추가: [[package]]
163추가: name = "libbz2-rs-sys"
164추가: version = "0.2.6"
165추가: source = "registry+https://github.com/rust-lang/crates.io-index"
166추가: checksum = "32f454fd6831a29c0e827ed075bca2a15be201bd57f4168f0fd1041124eab17e"
167추가:
100168[[package]]
101169name = "libc"
102170version = "0.2.191"
103171source = "registry+https://github.com/rust-lang/crates.io-index"
104172checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
105173
174추가: [[package]]
175추가: name = "lzma-rust2"
176추가: version = "0.25.0"
177추가: source = "registry+https://github.com/rust-lang/crates.io-index"
178추가: checksum = "ef1d73c59a56771343712b22ea5615092c612c16ba291c0979e3105dfeec4890"
179추가: dependencies = [
180추가: "sha2 0.11.1",
181추가: ]
182추가:
106183[[package]]
107184name = "pbkdf2"
108185version = "0.12.2"
109186source = "registry+https://github.com/rust-lang/crates.io-index"
110187checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2"
111188dependencies = [
112삭제: "digest",
189추가: "digest 0.10.7",
113190 "hmac",
114191]
115192
@@ -120,8 +197,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
120197checksum = "a978451301f4db1d02937a4ab3ccce137717b81826e79b7d49ffe3244a13c3b8"
121198dependencies = [
122199 "cfg-if",
123삭제: "cpufeatures",
124삭제: "digest",
200추가: "cpufeatures 0.2.17",
201추가: "digest 0.10.7",
125202]
126203
127204[[package]]
@@ -131,8 +208,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
131208checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
132209dependencies = [
133210 "cfg-if",
134삭제: "cpufeatures",
135삭제: "digest",
211추가: "cpufeatures 0.2.17",
212추가: "digest 0.10.7",
213추가: ]
214추가:
215추가: [[package]]
216추가: name = "sha2"
217추가: version = "0.11.1"
218추가: source = "registry+https://github.com/rust-lang/crates.io-index"
219추가: checksum = "47d7069beb7d6ac7b9acd1039986e73443f24234f41074da099d6f994ac9ad19"
220추가: dependencies = [
221추가: "cfg-if",
222추가: "cpufeatures 0.3.1",
223추가: "digest 0.11.3",
136224]
137225
138226[[package]]
@@ -164,10 +252,12 @@ name = "zipelo-archive-worker"
164252version = "0.1.0"
165253dependencies = [
166254 "aes",
255추가: "bzip2",
167256 "hmac",
257추가: "lzma-rust2",
168258 "pbkdf2",
169259 "sha1",
170삭제: "sha2",
260추가: "sha2 0.10.9",
171261 "subtle",
172262 "zeroize",
173263 "zlib-rs",
수정experiments/rust-archive-worker/Cargo.toml+8-0
@@ -7,6 +7,8 @@ publish = false
77autotests = false
88
99[dependencies]
10추가: bzip2 = "=0.6.1"
11추가: lzma-rust2 = { version = "=0.25.0", default-features = false, features = ["std", "xz"] }
1012aes = { version = "=0.8.4", features = ["zeroize"] }
1113hmac = "=0.12.1"
1214pbkdf2 = { version = "=0.12.2", default-features = false, features = ["hmac"] }
@@ -25,3 +27,9 @@ path = "../../tests/rust-archive-worker/main.rs"
2527# 대용량 시험의 CRC와 Deflate에도 배포판의 최적화를 적용함.
2628[profile.dev.package.zlib-rs]
2729opt-level = 3
30추가:
31추가: [profile.dev.package.libbz2-rs-sys]
32추가: opt-level = 3
33추가:
34추가: [profile.dev.package.lzma-rust2]
35추가: opt-level = 3
수정experiments/rust-archive-worker/README.md+20-1
@@ -2,7 +2,7 @@
22
33별도 프로세스의 stdin/stdout으로 revision 3 요청을 처리합니다. 제품 앱이 공유 codec으로 연결하며 프로세스 분리는 OS sandbox를 뜻하지 않습니다. 암호 기능은 capability=true이며 ZipCrypto 해제, WinZip AES-256 AE-1/AE-2 해제와 AE-2 생성을 지원합니다.
44
5삭제: - ZIP32/ZIP64 Store/Deflate 목록과 해제, ZIP32/ZIP64 생성, 기본 TAR/USTAR, GZ, TAR.GZ, 비암호화 7z 해제를 지원합니다. GZ 연결 멤버는 하나의 논리 스트림으로 합칩니다. 다중 볼륨, UTF-8로 해석할 수 없는 ZIP 이름, PAX/GNU 확장과 특수 항목 해제는 미지원입니다.
5추가: - ZIP32/ZIP64 Store/Deflate 목록과 해제, ZIP32/ZIP64 생성, 기본 TAR/USTAR, GZ, TAR.GZ, TAR.BZ2, TAR.XZ, 비암호화 7z 해제를 지원합니다. GZ 연결 멤버는 하나의 논리 스트림으로 합칩니다. 다중 볼륨, UTF-8로 해석할 수 없는 ZIP 이름, PAX/GNU 확장과 특수 항목 해제는 미지원입니다.
66- ZIP 이름: UTF-8 플래그(비트 11)가 있으면 이름이 UTF-8이어야 하며 아니면 Integrity입니다. 플래그가 없으면 CRC가 원래 이름과 맞는 Info-ZIP Unicode Path 확장 필드(0x7075, 버전 1)를 우선 쓰고, 다음으로 UTF-8로 유효한 이름 바이트를 그대로 씁니다(Linux/macOS 도구의 기본 동작). CRC가 다르거나 버전이 다른 확장 필드는 무시합니다. 그 밖의 CP437/CP949 등 레거시 이름은 코드 페이지를 추측하지 않고 UnsupportedFeature로 거부합니다. 어느 경로로 얻은 이름이든 같은 경로 안전성 검사와 충돌 검사를 거칩니다.
77- ZIP/TAR/GZ/TAR.GZ/7z 목록과 해제는 입력 기본 한도 u64::MAX, 해제 총량 16 GiB, 항목 10,000개입니다. 요청 limits는 이 값을 낮출 수 있습니다. 64 KiB 버퍼와 임시 파일로 입력과 검증 완료 payload를 처리해 모든 출력의 CRC, 크기와 경로를 게시 전에 검사합니다. checkpoint마다 취소, 부모 프로세스 생존과 300초 한도를 확인합니다. ZIP 생성은 원본을 하나씩 스냅샷으로 읽어 스트리밍으로 압축하며 원본 크기 합계에 16 GiB 한도를 적용합니다. ZIP64 크기와 오프셋은 필요한 항목에만 기록합니다. slice 기반 archive parser는 입력 64 MiB/출력 128 MiB, slice ZIP builder는 원본 및 결과 128 MiB 한도를 유지합니다.
88- 경로 깊이는 64개 구성 요소, 이름/출력 계획 메타데이터 예산은 8 MiB, 출력 계획 노드는 32,768개로 제한합니다. 이름 복제와 인덱스 비용을 보수적으로 계산해 할당 전에 Limit으로 거부합니다.
@@ -35,6 +35,25 @@ revision 2의 기존 필드와 오류 tag 0~12 및 입력/출력 기본 한도
3535- 합성 표본은 Python 표준 lzma로 생성합니다. 별도로 시스템 libarchive가 만든 LZMA1/LZMA2 표본을 해제하고, 합성 표본도 libarchive 읽기 API로 검사합니다. libarchive는 Linux 시험의 독립 참조 도구이며 제품 의존성이 아닙니다. 시험 도구와 표본은 tests/rust-archive-worker 아래에 있습니다.
3636- 형식 확장은 히나타 님과 합의한 Format::SevenZip=4입니다. 기존 값 0~3과 필드, 메시지 tag, 프레임 version은 유지합니다. 구버전 앱은 값 4를 거부하므로 앱 Format과 양방향 변환도 갱신해야 합니다. 이 백엔드 변경은 frontend 코드를 수정하지 않습니다.
3737
38추가: ## 압축 TAR 해제
39추가:
40추가: TAR.BZ2와 TAR.XZ는 확장자가 아닌 BZh 및 XZ 매직으로 판별하고 비공개 임시 파일로 먼저 해제합니다. 연결된 BZip2/XZ 스트림은 하나의 TAR로 합치며 XZ의 4바이트 정렬 스트림 패딩도 허용합니다. 빈 TAR, USTAR 이름과 빈 폴더를 지원하지만 독립 BZ2/XZ 데이터 파일은 TAR가 아니면 거부합니다.
41추가:
42추가: 해제 총량은 TAR 헤더와 패딩을 포함해 기존 16 GiB 이하이며 요청으로 낮출 수 있습니다. 64 KiB씩 실제 해제량을 확인하고 기록 전에 임시 저장소의 공간을 검사합니다. XZ는 블록별 LZMA2 디코더 메모리 32 MiB, 인덱스 8 MiB, 스트림 수와 스트림당 블록 수 각각 32,768을 상한으로 둡니다. 이 상한을 넘는 정상 파일도 Limit로 거부합니다. 해제 전체와 TAR 경로, 항목 종류 및 이름 충돌을 검증하기 전에는 목적지에 게시하지 않습니다. 출력 공간 검사, 안전한 충돌 처리, 취소와 300초 시간 제한도 기존 흐름을 사용합니다.
43추가:
44추가: XZ의 헤더, 인덱스, 푸터 CRC와 역방향 크기 및 전체 선언 해제량을 확인하고 실제 해제량과 비교합니다. 각 블록의 헤더와 LZMA2 청크 경계를 따라 압축 길이와 해제량을 인덱스 레코드 및 선택적 헤더 크기와 대조하므로 다른 블록이나 연결 스트림의 크기 변조가 상쇄되어도 Integrity로 거부합니다. 지원하는 BCJ와 Delta 필터는 길이를 보존합니다. 이 사전 검사는 payload를 해제하거나 할당하지 않으며 기존 디코더가 청크 내용과 데이터 블록의 CRC32/CRC64/SHA256 검사를 수행한 뒤에만 게시합니다. [XZ 명세 4.3절](https://tukaani.org/xz/xz-file-format.txt)의 블록별 Unpadded Size와 Uncompressed Size 검사를 적용합니다. XZ의 Check=None도 형식대로 허용하므로 데이터 체크섬이 없는 파일의 내용 무결성을 보장하지 않습니다. TAR의 PAX/GNU 확장, 링크와 특수 항목의 기존 제한도 유지합니다.
45추가:
46추가: 통신에는 기존 Format::Tar=1을 사용합니다. 압축 방식별 새 형식 값이나 메시지 변경은 없으며 목록 식별자는 원본 객체, 길이와 SHA256을 계속 포함합니다. 화면의 파일 선택 필터와 지원 안내, 새 형식의 UI 상황 추가는 frontend 연동 범위입니다.
47추가:
48추가: 의존성 선택 근거는 다음과 같습니다.
49추가:
50추가: - [bzip2 0.6.1](https://docs.rs/crate/bzip2/0.6.1/source/Cargo.toml)은 MIT OR Apache-2.0이며 기본 백엔드가 Rust 구현인 libbz2-rs-sys입니다. 고정 lockfile은 libbz2-rs-sys 0.2.6(bzip2-1.0.6 자유 라이선스)을 선택하고 Rust 할당자를 사용합니다. C 구현인 bzip2-sys 기능과 stdio/C 할당자는 활성화하지 않습니다.
51추가: - [lzma-rust2 0.25.0](https://docs.rs/lzma-rust2/latest/lzma_rust2/struct.XzReader.html)은 Apache-2.0의 Rust 구현입니다. std와 xz만 활성화해 인코더와 다중 스레드 구현을 제외하고 사전 할당 전 메모리 제한을 적용합니다. CRC와 인덱스 레코드 개수를 검증하며 연결 스트림을 끝까지 읽습니다. 레코드별 크기는 작업자가 별도로 대조합니다.
52추가: - 두 라이브러리와 새 전이 의존성의 원문은 Cargo 체크섬을 대조하는 기존 packaging/licenses.py가 고지에 자동 포함합니다. tests/release-packages/test_compressed_tar_licenses.py는 실제 고지에 세 압축 라이브러리의 원문과 해시가 포함되고 C 압축 백엔드가 없는지 확인합니다.
53추가: - 2026-11-13 [RUSTSEC-2023-0004](https://rustsec.org/advisories/RUSTSEC-2023-0004.html)의 bzip2 DoS 권고와 수정 범위(>=0.4.4)를 확인했습니다. 고정 lockfile의 bzip2 0.6.1은 수정 범위에 해당하므로 이 권고의 영향을 받지 않습니다. 새 전이 sha2 0.11.1은 RUSTSEC-2021-0100의 수정 범위(>=0.9.8)에 해당합니다. 전체 최신 DB 자동 감사와 취약점 부재를 보장하는 확인은 수행하지 않았습니다.
54추가:
55추가: Python 표준 bz2, lzma와 tarfile로 독립 생성 및 해제한 결과의 SHA256과 실제 작업자 결과를 비교합니다. tests/rust-archive-worker/compressed_tar.rs는 정상, 빈 TAR, 연결 스트림, XZ 필터와 체크 방식, 잘림과 손상, 푸터/인덱스 크기, 큰 사전, 작은 출력 한도의 압축 폭탄, 한도 경계, 경로 이탈, 링크, 목록 식별자와 선택, 취소 및 디코더 임시 공간 실패를 검증합니다.
56추가:
3857## 암호 ZIP
3958
4059- AES는 [WinZip AE-1/AE-2 명세](https://www.winzip.com/en/support/aes-encryption/)의 method 99, 0x9901 추가 필드, PBKDF2-HMAC-SHA1 1000회, 16바이트 salt, AES-256 CTR와 HMAC-SHA1-80 형식을 사용합니다. 새 파일은 CRC를 노출하지 않는 AE-2입니다. AE-1은 인증과 CRC를 모두 검증합니다. AES-128/192와 PKWARE Strong Encryption은 미지원입니다.
추가experiments/rust-archive-worker/src/compressed_tar.rs+367-0
@@ -0,0 +1,367 @@
1추가: use crate::{protocol::ErrorCode, space, spool};
2추가: use std::{
3추가: cell::RefCell,
4추가: fs::File,
5추가: io::{self, BufReader, Read, Seek, Write},
6추가: };
7추가: use zeroize::Zeroizing;
8추가:
9추가: type Result<T> = std::result::Result<T, ErrorCode>;
10추가: const CHUNK: usize = 65_536;
11추가: const XZ_MEMORY_KIB: u32 = 32 * 1024;
12추가:
13추가: #[derive(Clone, Copy)]
14추가: pub(crate) enum Compression {
15추가: Bzip2,
16추가: Xz,
17추가: }
18추가:
19추가: #[derive(Debug)]
20추가: struct InputError(ErrorCode);
21추가:
22추가: impl std::fmt::Display for InputError {
23추가: fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
24추가: write!(formatter, "{:?}", self.0)
25추가: }
26추가: }
27추가:
28추가: impl std::error::Error for InputError {}
29추가:
30추가: struct CheckedInput<'a, F> {
31추가: file: &'a mut File,
32추가: check: &'a RefCell<&'a mut F>,
33추가: }
34추가:
35추가: impl<F: FnMut() -> Result<()>> Read for CheckedInput<'_, F> {
36추가: fn read(&mut self, buffer: &mut [u8]) -> io::Result<usize> {
37추가: (self.check.borrow_mut())().map_err(|error| io::Error::other(InputError(error)))?;
38추가: let count = buffer.len().min(CHUNK);
39추가: self.file
40추가: .read(&mut buffer[..count])
41추가: .map_err(|_| io::Error::other(InputError(ErrorCode::Io)))
42추가: }
43추가: }
44추가:
45추가: fn decode_error(error: io::Error) -> ErrorCode {
46추가: if let Some(error) = error
47추가: .get_ref()
48추가: .and_then(|error| error.downcast_ref::<InputError>())
49추가: {
50추가: return error.0;
51추가: }
52추가: match error.kind() {
53추가: io::ErrorKind::OutOfMemory => ErrorCode::Limit,
54추가: io::ErrorKind::Unsupported => ErrorCode::UnsupportedFeature,
55추가: _ => ErrorCode::Integrity,
56추가: }
57추가: }
58추가:
59추가: pub(crate) fn decode(
60추가: source: &mut File,
61추가: compression: Compression,
62추가: limit: u64,
63추가: check: &mut impl FnMut() -> Result<()>,
64추가: ) -> Result<(File, u64)> {
65추가: check()?;
66추가: let expected = if matches!(compression, Compression::Xz) {
67추가: Some(xz_layout(source, limit, check)?)
68추가: } else {
69추가: None
70추가: };
71추가: source.rewind().map_err(space::io_error)?;
72추가: let mut output = spool::temporary()?;
73추가: let check = RefCell::new(check);
74추가: let input = CheckedInput {
75추가: file: source,
76추가: check: &check,
77추가: };
78추가: let mut reader: Box<dyn Read + '_> = match compression {
79추가: Compression::Bzip2 => Box::new(bzip2::bufread::MultiBzDecoder::new(
80추가: BufReader::with_capacity(CHUNK, input),
81추가: )),
82추가: Compression::Xz => Box::new(lzma_rust2::XzReader::new_mem_limit(
83추가: input,
84추가: true,
85추가: XZ_MEMORY_KIB,
86추가: )),
87추가: };
88추가: let mut buffer = Zeroizing::new([0; CHUNK]);
89추가: let mut total = 0u64;
90추가: loop {
91추가: (check.borrow_mut())()?;
92추가: let count = reader.read(&mut buffer[..]).map_err(decode_error)?;
93추가: if count == 0 {
94추가: break;
95추가: }
96추가: total = total
97추가: .checked_add(count as u64)
98추가: .filter(|total| *total <= limit)
99추가: .ok_or(ErrorCode::Limit)?;
100추가: // 전체 검증 전에는 비공개 임시 파일에만 기록함.
101추가: space::ensure(&output, count as u64)?;
102추가: output
103추가: .write_all(&buffer[..count])
104추가: .map_err(space::io_error)?;
105추가: }
106추가: (check.borrow_mut())()?;
107추가: if expected.is_some_and(|expected| expected != total) {
108추가: return Err(ErrorCode::Integrity);
109추가: }
110추가: Ok((output, total))
111추가: }
112추가:
113추가: fn read_at(
114추가: source: &mut File,
115추가: offset: u64,
116추가: bytes: &mut [u8],
117추가: check: &mut impl FnMut() -> Result<()>,
118추가: ) -> Result<()> {
119추가: check()?;
120추가: source
121추가: .seek(std::io::SeekFrom::Start(offset))
122추가: .map_err(space::io_error)?;
123추가: source.read_exact(bytes).map_err(|error| {
124추가: if error.kind() == io::ErrorKind::UnexpectedEof {
125추가: ErrorCode::Integrity
126추가: } else {
127추가: ErrorCode::Io
128추가: }
129추가: })
130추가: }
131추가:
132추가: fn vli(bytes: &[u8], cursor: &mut usize) -> Result<u64> {
133추가: let mut value = 0u64;
134추가: for shift in (0..63).step_by(7) {
135추가: let byte = *bytes.get(*cursor).ok_or(ErrorCode::Integrity)?;
136추가: *cursor += 1;
137추가: value |= u64::from(byte & 127) << shift;
138추가: if byte & 128 == 0 {
139추가: if shift != 0 && byte == 0 {
140추가: return Err(ErrorCode::Integrity);
141추가: }
142추가: return Ok(value);
143추가: }
144추가: }
145추가: Err(ErrorCode::Integrity)
146추가: }
147추가:
148추가: fn lzma2_size(
149추가: source: &mut File,
150추가: mut at: u64,
151추가: end: u64,
152추가: expected: u64,
153추가: check: &mut impl FnMut() -> Result<()>,
154추가: ) -> Result<()> {
155추가: let mut size = 0u64;
156추가: while at < end {
157추가: let mut control = [0];
158추가: read_at(source, at, &mut control, check)?;
159추가: at += 1;
160추가: if control[0] == 0 {
161추가: return if at == end && size == expected {
162추가: Ok(())
163추가: } else {
164추가: Err(ErrorCode::Integrity)
165추가: };
166추가: }
167추가: let header_len = match control[0] {
168추가: 1 | 2 => 2,
169추가: 128..=255 => 4 + usize::from(control[0] >= 192),
170추가: _ => return Err(ErrorCode::Integrity),
171추가: };
172추가: if end - at < header_len as u64 {
173추가: return Err(ErrorCode::Integrity);
174추가: }
175추가: let mut header = [0; 5];
176추가: read_at(source, at, &mut header[..header_len], check)?;
177추가: at += header_len as u64;
178추가: let unpacked = u64::from(u16::from_be_bytes(header[..2].try_into().unwrap())) + 1;
179추가: let (packed, unpacked) = if control[0] >= 128 {
180추가: (
181추가: u64::from(u16::from_be_bytes(header[2..4].try_into().unwrap())) + 1,
182추가: (u64::from(control[0] & 31) << 16) + unpacked,
183추가: )
184추가: } else {
185추가: (unpacked, unpacked)
186추가: };
187추가: at = at
188추가: .checked_add(packed)
189추가: .filter(|at| *at <= end)
190추가: .ok_or(ErrorCode::Integrity)?;
191추가: size = size
192추가: .checked_add(unpacked)
193추가: .filter(|size| *size <= expected)
194추가: .ok_or(ErrorCode::Integrity)?;
195추가: }
196추가: Err(ErrorCode::Integrity)
197추가: }
198추가:
199추가: fn xz_block(
200추가: source: &mut File,
201추가: start: u64,
202추가: unpadded: u64,
203추가: size: u64,
204추가: check_size: u64,
205추가: check: &mut impl FnMut() -> Result<()>,
206추가: ) -> Result<()> {
207추가: let mut header = [0; 1024];
208추가: read_at(source, start, &mut header[..1], check)?;
209추가: if header[0] == 0 {
210추가: return Err(ErrorCode::Integrity);
211추가: }
212추가: let header_len = (usize::from(header[0]) + 1) * 4;
213추가: let packed = unpadded
214추가: .checked_sub(header_len as u64 + check_size)
215추가: .filter(|packed| *packed != 0)
216추가: .ok_or(ErrorCode::Integrity)?;
217추가: read_at(source, start, &mut header[..header_len], check)?;
218추가: let data = &header[..header_len - 4];
219추가: if zlib_rs::crc32::crc32(0, data)
220추가: != u32::from_le_bytes(header[header_len - 4..header_len].try_into().unwrap())
221추가: {
222추가: return Err(ErrorCode::Integrity);
223추가: }
224추가: let flags = header[1];
225추가: if flags & 0x3c != 0 {
226추가: return Err(ErrorCode::UnsupportedFeature);
227추가: }
228추가: let mut cursor = 2;
229추가: if flags & 0x40 != 0 && vli(data, &mut cursor)? != packed {
230추가: return Err(ErrorCode::Integrity);
231추가: }
232추가: if flags & 0x80 != 0 && vli(data, &mut cursor)? != size {
233추가: return Err(ErrorCode::Integrity);
234추가: }
235추가: let filters = usize::from(flags & 3) + 1;
236추가: for number in 0..filters {
237추가: let id = vli(data, &mut cursor)?;
238추가: // 지원 필터는 길이를 보존하며 마지막 필터는 LZMA2임.
239추가: let supported = if number + 1 == filters {
240추가: id == 0x21
241추가: } else {
242추가: (0x03..=0x0b).contains(&id)
243추가: };
244추가: if !supported {
245추가: return Err(ErrorCode::UnsupportedFeature);
246추가: }
247추가: let properties = vli(data, &mut cursor)?;
248추가: cursor = cursor
249추가: .checked_add(usize::try_from(properties).map_err(|_| ErrorCode::Integrity)?)
250추가: .filter(|cursor| *cursor <= data.len())
251추가: .ok_or(ErrorCode::Integrity)?;
252추가: }
253추가: if data[cursor..].iter().any(|byte| *byte != 0) {
254추가: return Err(ErrorCode::Integrity);
255추가: }
256추가: let data_start = start
257추가: .checked_add(header_len as u64)
258추가: .ok_or(ErrorCode::Integrity)?;
259추가: let data_end = data_start.checked_add(packed).ok_or(ErrorCode::Integrity)?;
260추가: // 청크 경계와 해제량을 블록별로 대조한 뒤 기존 디코더가 내용과 체크섬을 검증함.
261추가: lzma2_size(source, data_start, data_end, size, check)
262추가: }
263추가:
264추가: // 역방향 인덱스 검사는 디코더의 할당과 실제 해제량 검사보다 먼저 수행함.
265추가: fn xz_layout(source: &mut File, limit: u64, check: &mut impl FnMut() -> Result<()>) -> Result<u64> {
266추가: use zlib_rs::crc32::crc32;
267추가: let mut end = source.metadata().map_err(space::io_error)?.len();
268추가: let mut total = 0u64;
269추가: let mut streams = 0usize;
270추가: while end != 0 {
271추가: let mut tail = [0; 4];
272추가: loop {
273추가: let at = end.checked_sub(4).ok_or(ErrorCode::Integrity)?;
274추가: read_at(source, at, &mut tail, check)?;
275추가: if tail != [0; 4] {
276추가: break;
277추가: }
278추가: end = at;
279추가: }
280추가: streams += 1;
281추가: if streams > crate::archive::MAX_OUTPUT_NODES {
282추가: return Err(ErrorCode::Limit);
283추가: }
284추가: let footer_at = end.checked_sub(12).ok_or(ErrorCode::Integrity)?;
285추가: let mut footer = [0; 12];
286추가: read_at(source, footer_at, &mut footer, check)?;
287추가: if &footer[10..] != b"YZ"
288추가: || crc32(0, &footer[4..10]) != u32::from_le_bytes(footer[..4].try_into().unwrap())
289추가: {
290추가: return Err(ErrorCode::Integrity);
291추가: }
292추가: let index_len = (u64::from(u32::from_le_bytes(footer[4..8].try_into().unwrap())) + 1) * 4;
293추가: if index_len > crate::archive::MAX_METADATA_BYTES as u64 {
294추가: return Err(ErrorCode::Limit);
295추가: }
296추가: if index_len < 8 {
297추가: return Err(ErrorCode::Integrity);
298추가: }
299추가: let index_at = footer_at
300추가: .checked_sub(index_len)
301추가: .ok_or(ErrorCode::Integrity)?;
302추가: let mut index = vec![0; index_len as usize];
303추가: read_at(source, index_at, &mut index, check)?;
304추가: let data_end = index.len() - 4;
305추가: if index[0] != 0
306추가: || crc32(0, &index[..data_end])
307추가: != u32::from_le_bytes(index[data_end..].try_into().unwrap())
308추가: {
309추가: return Err(ErrorCode::Integrity);
310추가: }
311추가: let mut cursor = 1;
312추가: let count = vli(&index[..data_end], &mut cursor)?;
313추가: if count > crate::archive::MAX_OUTPUT_NODES as u64 {
314추가: return Err(ErrorCode::Limit);
315추가: }
316추가: let mut blocks = 0u64;
317추가: let mut records = Vec::new();
318추가: for _ in 0..count {
319추가: check()?;
320추가: let unpadded = vli(&index[..data_end], &mut cursor)?;
321추가: let size = vli(&index[..data_end], &mut cursor)?;
322추가: if unpadded == 0 {
323추가: return Err(ErrorCode::Integrity);
324추가: }
325추가: blocks = blocks
326추가: .checked_add(unpadded.checked_add(3).ok_or(ErrorCode::Integrity)? & !3)
327추가: .ok_or(ErrorCode::Integrity)?;
328추가: total = total
329추가: .checked_add(size)
330추가: .filter(|total| *total <= limit)
331추가: .ok_or(ErrorCode::Limit)?;
332추가: records.push((unpadded, size));
333추가: }
334추가: if data_end - cursor > 3 || index[cursor..data_end].iter().any(|byte| *byte != 0) {
335추가: return Err(ErrorCode::Integrity);
336추가: }
337추가: let start = index_at
338추가: .checked_sub(blocks)
339추가: .and_then(|at| at.checked_sub(12))
340추가: .ok_or(ErrorCode::Integrity)?;
341추가: let mut header = [0; 12];
342추가: read_at(source, start, &mut header, check)?;
343추가: if &header[..6] != b"\xfd7zXZ\0"
344추가: || header[6..8] != footer[8..10]
345추가: || crc32(0, &header[6..8]) != u32::from_le_bytes(header[8..].try_into().unwrap())
346추가: {
347추가: return Err(ErrorCode::Integrity);
348추가: }
349추가: let check_size = match header[7] {
350추가: 0 => 0,
351추가: 1 => 4,
352추가: 4 => 8,
353추가: 10 => 32,
354추가: _ => return Err(ErrorCode::UnsupportedFeature),
355추가: };
356추가: let mut block_at = start + 12;
357추가: for (unpadded, size) in records {
358추가: xz_block(source, block_at, unpadded, size, check_size, check)?;
359추가: block_at += (unpadded + 3) & !3;
360추가: }
361추가: end = start;
362추가: }
363추가: if streams == 0 {
364추가: return Err(ErrorCode::Integrity);
365추가: }
366추가: Ok(total)
367추가: }
수정experiments/rust-archive-worker/src/lib.rs+1-0
@@ -1,4 +1,5 @@
11pub mod archive;
2추가: mod compressed_tar;
23mod create;
34mod create_sources;
45mod crypto;
수정experiments/rust-archive-worker/src/streaming.rs+15-0
@@ -66,6 +66,21 @@ impl Catalog {
6666 {
6767 return zip(source, len, limits, decode, password, check);
6868 }
69추가: let compression = if magic.starts_with(b"BZh") {
70추가: Some(crate::compressed_tar::Compression::Bzip2)
71추가: } else if &magic == b"\xfd7zXZ\0" {
72추가: Some(crate::compressed_tar::Compression::Xz)
73추가: } else {
74추가: None
75추가: };
76추가: if let Some(compression) = compression {
77추가: let (data, expanded) =
78추가: crate::compressed_tar::decode(source, compression, limits.output, check)?;
79추가: if expanded < 1024 {
80추가: return Err(ErrorCode::Integrity);
81추가: }
82추가: return tar(data, expanded, limits, Format::Tar, check);
83추가: }
6984 if magic.starts_with(&[31, 139]) {
7085 let mut data = spool::temporary()?;
7186 io(source.rewind())?;
수정experiments/rust-ui-memory-app/Cargo.lock+102-12
@@ -124,7 +124,7 @@ checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0"
124124dependencies = [
125125 "cfg-if",
126126 "cipher",
127삭제: "cpufeatures",
127추가: "cpufeatures 0.2.17",
128128 "zeroize",
129129]
130130
@@ -462,6 +462,15 @@ dependencies = [
462462 "generic-array",
463463]
464464
465추가: [[package]]
466추가: name = "block-buffer"
467추가: version = "0.12.1"
468추가: source = "registry+https://github.com/rust-lang/crates.io-index"
469추가: checksum = "d2f6c7dbe95a6ed67ad9f18e57daf93a2f034c524b99fd2b76d18fdfeb6660aa"
470추가: dependencies = [
471추가: "hybrid-array",
472추가: ]
473추가:
465474[[package]]
466475name = "block2"
467476version = "0.5.1"
@@ -531,6 +540,15 @@ version = "1.12.1"
531540source = "registry+https://github.com/rust-lang/crates.io-index"
532541checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04"
533542
543추가: [[package]]
544추가: name = "bzip2"
545추가: version = "0.6.1"
546추가: source = "registry+https://github.com/rust-lang/crates.io-index"
547추가: checksum = "f3a53fac24f34a81bc9954b5d6cfce0c21e18ec6959f44f56e8e90e4bb7c346c"
548추가: dependencies = [
549추가: "libbz2-rs-sys",
550추가: ]
551추가:
534552[[package]]
535553name = "calloop"
536554version = "0.13.0"
@@ -620,7 +638,7 @@ version = "0.4.4"
620638source = "registry+https://github.com/rust-lang/crates.io-index"
621639checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"
622640dependencies = [
623삭제: "crypto-common",
641추가: "crypto-common 0.1.7",
624642 "inout",
625643]
626644
@@ -670,6 +688,12 @@ dependencies = [
670688 "crossbeam-utils",
671689]
672690
691추가: [[package]]
692추가: name = "const-oid"
693추가: version = "0.10.3"
694추가: source = "registry+https://github.com/rust-lang/crates.io-index"
695추가: checksum = "be95d4a884358a21a199689323c29e9256b4a1b315e22f183d155422041d3a9a"
696추가:
673697[[package]]
674698name = "constant_time_eq"
675699version = "0.6.1"
@@ -728,6 +752,15 @@ dependencies = [
728752 "libc",
729753]
730754
755추가: [[package]]
756추가: name = "cpufeatures"
757추가: version = "0.3.1"
758추가: source = "registry+https://github.com/rust-lang/crates.io-index"
759추가: checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566"
760추가: dependencies = [
761추가: "libc",
762추가: ]
763추가:
731764[[package]]
732765name = "crc32fast"
733766version = "1.5.5"
@@ -759,6 +792,15 @@ dependencies = [
759792 "typenum",
760793]
761794
795추가: [[package]]
796추가: name = "crypto-common"
797추가: version = "0.2.2"
798추가: source = "registry+https://github.com/rust-lang/crates.io-index"
799추가: checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453"
800추가: dependencies = [
801추가: "hybrid-array",
802추가: ]
803추가:
762804[[package]]
763805name = "cursor-icon"
764806version = "1.2.0"
@@ -771,11 +813,22 @@ version = "0.10.7"
771813source = "registry+https://github.com/rust-lang/crates.io-index"
772814checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
773815dependencies = [
774삭제: "block-buffer",
775삭제: "crypto-common",
816추가: "block-buffer 0.10.4",
817추가: "crypto-common 0.1.7",
776818 "subtle",
777819]
778820
821추가: [[package]]
822추가: name = "digest"
823추가: version = "0.11.3"
824추가: source = "registry+https://github.com/rust-lang/crates.io-index"
825추가: checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2"
826추가: dependencies = [
827추가: "block-buffer 0.12.1",
828추가: "const-oid",
829추가: "crypto-common 0.2.2",
830추가: ]
831추가:
779832[[package]]
780833name = "dispatch"
781834version = "0.2.0"
@@ -1533,7 +1586,16 @@ version = "0.12.1"
15331586source = "registry+https://github.com/rust-lang/crates.io-index"
15341587checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"
15351588dependencies = [
1536삭제: "digest",
1589추가: "digest 0.10.7",
1590추가: ]
1591추가:
1592추가: [[package]]
1593추가: name = "hybrid-array"
1594추가: version = "0.4.15"
1595추가: source = "registry+https://github.com/rust-lang/crates.io-index"
1596추가: checksum = "27f864f10dfb56725ce5ce5472bc52252c8f93a4ab86327122cebf62c5f59a17"
1597추가: dependencies = [
1598추가: "typenum",
15371599]
15381600
15391601[[package]]
@@ -1779,6 +1841,12 @@ dependencies = [
17791841 "smallvec",
17801842]
17811843
1844추가: [[package]]
1845추가: name = "libbz2-rs-sys"
1846추가: version = "0.2.6"
1847추가: source = "registry+https://github.com/rust-lang/crates.io-index"
1848추가: checksum = "32f454fd6831a29c0e827ed075bca2a15be201bd57f4168f0fd1041124eab17e"
1849추가:
17821850[[package]]
17831851name = "libc"
17841852version = "0.2.191"
@@ -1858,6 +1926,15 @@ version = "0.4.35"
18581926source = "registry+https://github.com/rust-lang/crates.io-index"
18591927checksum = "5d15f86d12da44cd8d4ec3c73984537eb7f4cadcb9776a575a0a8a05ca11005c"
18601928
1929추가: [[package]]
1930추가: name = "lzma-rust2"
1931추가: version = "0.25.0"
1932추가: source = "registry+https://github.com/rust-lang/crates.io-index"
1933추가: checksum = "ef1d73c59a56771343712b22ea5615092c612c16ba291c0979e3105dfeec4890"
1934추가: dependencies = [
1935추가: "sha2 0.11.1",
1936추가: ]
1937추가:
18611938[[package]]
18621939name = "memchr"
18631940version = "2.8.3"
@@ -2419,7 +2496,7 @@ version = "0.12.2"
24192496source = "registry+https://github.com/rust-lang/crates.io-index"
24202497checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2"
24212498dependencies = [
2422삭제: "digest",
2499추가: "digest 0.10.7",
24232500 "hmac",
24242501]
24252502
@@ -2966,8 +3043,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
29663043checksum = "a978451301f4db1d02937a4ab3ccce137717b81826e79b7d49ffe3244a13c3b8"
29673044dependencies = [
29683045 "cfg-if",
2969삭제: "cpufeatures",
2970삭제: "digest",
3046추가: "cpufeatures 0.2.17",
3047추가: "digest 0.10.7",
29713048]
29723049
29733050[[package]]
@@ -2977,8 +3054,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
29773054checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
29783055dependencies = [
29793056 "cfg-if",
2980삭제: "cpufeatures",
2981삭제: "digest",
3057추가: "cpufeatures 0.2.17",
3058추가: "digest 0.10.7",
3059추가: ]
3060추가:
3061추가: [[package]]
3062추가: name = "sha2"
3063추가: version = "0.11.1"
3064추가: source = "registry+https://github.com/rust-lang/crates.io-index"
3065추가: checksum = "47d7069beb7d6ac7b9acd1039986e73443f24234f41074da099d6f994ac9ad19"
3066추가: dependencies = [
3067추가: "cfg-if",
3068추가: "cpufeatures 0.3.1",
3069추가: "digest 0.11.3",
29823070]
29833071
29843072[[package]]
@@ -4564,10 +4652,12 @@ name = "zipelo-archive-worker"
45644652version = "0.1.0"
45654653dependencies = [
45664654 "aes",
4655추가: "bzip2",
45674656 "hmac",
4657추가: "lzma-rust2",
45684658 "pbkdf2",
45694659 "sha1",
4570삭제: "sha2",
4660추가: "sha2 0.10.9",
45714661 "subtle",
45724662 "zeroize",
45734663 "zlib-rs",
@@ -4584,7 +4674,7 @@ dependencies = [
45844674name = "zipelo-memory-ustar-reader"
45854675version = "0.1.0"
45864676dependencies = [
4587삭제: "sha2",
4677추가: "sha2 0.10.9",
45884678 "subtle",
45894679]
45904680
수정experiments/rust-ui-memory-app/src/archive_dialog.rs+1-1
@@ -37,7 +37,7 @@ pub trait Dialogs {
3737
3838pub fn archive_filters() -> Vec<(&'static str, Vec<String>)> {
3939 let mut extensions = Vec::new();
40삭제: for extension in ["zip", "7z", "tar", "gz", "tgz"] {
40추가: for extension in ["zip", "7z", "tar", "gz", "tgz", "tar.bz2", "tar.xz"] {
4141 let mut variants = vec![String::new()];
4242 for character in extension.chars() {
4343 let mut next = Vec::new();
수정experiments/rust-ui-memory-app/src/archive_present.rs+5-2
@@ -70,8 +70,11 @@ pub fn middle_text(text: &str, max_chars: usize) -> String {
7070pub fn default_destination(archive: &Path) -> PathBuf {
7171 let name = archive.file_name().unwrap_or_default().to_string_lossy();
7272 let lower = name.to_ascii_lowercase();
73삭제: let stem = if lower.ends_with(".tar.gz") {
74삭제: &name[..name.len() - 7]
73추가: let compound = [".tar.bz2", ".tar.gz", ".tar.xz"]
74추가: .into_iter()
75추가: .find(|suffix| lower.ends_with(suffix));
76추가: let stem = if let Some(suffix) = compound {
77추가: &name[..name.len() - suffix.len()]
7578 } else {
7679 name.rsplit_once('.')
7780 .map_or(name.as_ref(), |(stem, _)| stem)
수정experiments/rust-ui-memory-app/src/archive_screen.rs+1-1
@@ -1103,7 +1103,7 @@ impl ArchiveApp {
11031103 ui.add_space(theme::PAD as f32);
11041104 ui.colored_label(
11051105 theme::MUTED,
1106삭제: "ZIP, 7z, TAR, GZ, TAR.GZ 파일을 열 수 있습니다",
1106추가: "ZIP, 7z, TAR, GZ, TAR.GZ, TAR.BZ2, TAR.XZ 파일을 열 수 있습니다",
11071107 );
11081108 });
11091109 }
추가tests/release-packages/test_compressed_tar_licenses.py+39-0
@@ -0,0 +1,39 @@
1추가: """압축 TAR 의존성의 원문 고지와 Rust 백엔드를 검증함."""
2추가:
3추가: import importlib.util
4추가: from pathlib import Path
5추가: import unittest
6추가:
7추가:
8추가: ROOT = Path(__file__).resolve().parents[2]
9추가: SPEC = importlib.util.spec_from_file_location("compressed_tar_licenses", ROOT / "packaging/licenses.py")
10추가: LICENSES = importlib.util.module_from_spec(SPEC)
11추가: SPEC.loader.exec_module(LICENSES)
12추가:
13추가:
14추가: class CompressedTarLicenses(unittest.TestCase):
15추가: def test_registry_originals_are_in_generated_worker_notice(self):
16추가: manifest = ROOT / "experiments/rust-archive-worker/Cargo.toml"
17추가: records = LICENSES.inventory([manifest])
18추가: selected = {record["name"]: record for record in records}
19추가: expected = {
20추가: "bzip2": ("0.6.1", "MIT OR Apache-2.0"),
21추가: "libbz2-rs-sys": ("0.2.6", "bzip2-1.0.6"),
22추가: "lzma-rust2": ("0.25.0", "Apache-2.0"),
23추가: }
24추가: notice = LICENSES.render(records)
25추가: for name, (version, license_id) in expected.items():
26추가: with self.subTest(name=name):
27추가: record = selected[name]
28추가: self.assertEqual(record["version"], version)
29추가: self.assertEqual(record["license"], license_id)
30추가: self.assertTrue(record["files"])
31추가: self.assertIn(f"Crate: {name} {version}\n", notice)
32추가: for original in record["files"]:
33추가: self.assertIn(original["text"], notice)
34추가: self.assertIn(original["sha256"], notice)
35추가: self.assertTrue({"bzip2-sys", "lzma-sys", "liblzma-sys", "xz2"}.isdisjoint(selected))
36추가:
37추가:
38추가: if __name__ == "__main__":
39추가: unittest.main()
수정tests/rust-app-real-worker/Cargo.lock+101-11
@@ -10,7 +10,7 @@ checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0"
1010dependencies = [
1111 "cfg-if",
1212 "cipher",
13삭제: "cpufeatures",
13추가: "cpufeatures 0.2.17",
1414 "zeroize",
1515]
1616
@@ -23,6 +23,24 @@ dependencies = [
2323 "generic-array",
2424]
2525
26추가: [[package]]
27추가: name = "block-buffer"
28추가: version = "0.12.1"
29추가: source = "registry+https://github.com/rust-lang/crates.io-index"
30추가: checksum = "d2f6c7dbe95a6ed67ad9f18e57daf93a2f034c524b99fd2b76d18fdfeb6660aa"
31추가: dependencies = [
32추가: "hybrid-array",
33추가: ]
34추가:
35추가: [[package]]
36추가: name = "bzip2"
37추가: version = "0.6.1"
38추가: source = "registry+https://github.com/rust-lang/crates.io-index"
39추가: checksum = "f3a53fac24f34a81bc9954b5d6cfce0c21e18ec6959f44f56e8e90e4bb7c346c"
40추가: dependencies = [
41추가: "libbz2-rs-sys",
42추가: ]
43추가:
2644[[package]]
2745name = "cfg-if"
2846version = "1.0.5"
@@ -35,10 +53,16 @@ version = "0.4.4"
3553source = "registry+https://github.com/rust-lang/crates.io-index"
3654checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"
3755dependencies = [
38삭제: "crypto-common",
56추가: "crypto-common 0.1.7",
3957 "inout",
4058]
4159
60추가: [[package]]
61추가: name = "const-oid"
62추가: version = "0.10.3"
63추가: source = "registry+https://github.com/rust-lang/crates.io-index"
64추가: checksum = "be95d4a884358a21a199689323c29e9256b4a1b315e22f183d155422041d3a9a"
65추가:
4266[[package]]
4367name = "cpufeatures"
4468version = "0.2.17"
@@ -48,6 +72,15 @@ dependencies = [
4872 "libc",
4973]
5074
75추가: [[package]]
76추가: name = "cpufeatures"
77추가: version = "0.3.1"
78추가: source = "registry+https://github.com/rust-lang/crates.io-index"
79추가: checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566"
80추가: dependencies = [
81추가: "libc",
82추가: ]
83추가:
5184[[package]]
5285name = "crypto-common"
5386version = "0.1.7"
@@ -58,17 +91,37 @@ dependencies = [
5891 "typenum",
5992]
6093
94추가: [[package]]
95추가: name = "crypto-common"
96추가: version = "0.2.2"
97추가: source = "registry+https://github.com/rust-lang/crates.io-index"
98추가: checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453"
99추가: dependencies = [
100추가: "hybrid-array",
101추가: ]
102추가:
61103[[package]]
62104name = "digest"
63105version = "0.10.7"
64106source = "registry+https://github.com/rust-lang/crates.io-index"
65107checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
66108dependencies = [
67삭제: "block-buffer",
68삭제: "crypto-common",
109추가: "block-buffer 0.10.4",
110추가: "crypto-common 0.1.7",
69111 "subtle",
70112]
71113
114추가: [[package]]
115추가: name = "digest"
116추가: version = "0.11.3"
117추가: source = "registry+https://github.com/rust-lang/crates.io-index"
118추가: checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2"
119추가: dependencies = [
120추가: "block-buffer 0.12.1",
121추가: "const-oid",
122추가: "crypto-common 0.2.2",
123추가: ]
124추가:
72125[[package]]
73126name = "generic-array"
74127version = "0.14.7"
@@ -85,7 +138,16 @@ version = "0.12.1"
85138source = "registry+https://github.com/rust-lang/crates.io-index"
86139checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"
87140dependencies = [
88삭제: "digest",
141추가: "digest 0.10.7",
142추가: ]
143추가:
144추가: [[package]]
145추가: name = "hybrid-array"
146추가: version = "0.4.15"
147추가: source = "registry+https://github.com/rust-lang/crates.io-index"
148추가: checksum = "27f864f10dfb56725ce5ce5472bc52252c8f93a4ab86327122cebf62c5f59a17"
149추가: dependencies = [
150추가: "typenum",
89151]
90152
91153[[package]]
@@ -97,19 +159,34 @@ dependencies = [
97159 "generic-array",
98160]
99161
162추가: [[package]]
163추가: name = "libbz2-rs-sys"
164추가: version = "0.2.6"
165추가: source = "registry+https://github.com/rust-lang/crates.io-index"
166추가: checksum = "32f454fd6831a29c0e827ed075bca2a15be201bd57f4168f0fd1041124eab17e"
167추가:
100168[[package]]
101169name = "libc"
102170version = "0.2.191"
103171source = "registry+https://github.com/rust-lang/crates.io-index"
104172checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
105173
174추가: [[package]]
175추가: name = "lzma-rust2"
176추가: version = "0.25.0"
177추가: source = "registry+https://github.com/rust-lang/crates.io-index"
178추가: checksum = "ef1d73c59a56771343712b22ea5615092c612c16ba291c0979e3105dfeec4890"
179추가: dependencies = [
180추가: "sha2 0.11.1",
181추가: ]
182추가:
106183[[package]]
107184name = "pbkdf2"
108185version = "0.12.2"
109186source = "registry+https://github.com/rust-lang/crates.io-index"
110187checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2"
111188dependencies = [
112삭제: "digest",
189추가: "digest 0.10.7",
113190 "hmac",
114191]
115192
@@ -120,8 +197,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
120197checksum = "a978451301f4db1d02937a4ab3ccce137717b81826e79b7d49ffe3244a13c3b8"
121198dependencies = [
122199 "cfg-if",
123삭제: "cpufeatures",
124삭제: "digest",
200추가: "cpufeatures 0.2.17",
201추가: "digest 0.10.7",
125202]
126203
127204[[package]]
@@ -131,8 +208,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
131208checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
132209dependencies = [
133210 "cfg-if",
134삭제: "cpufeatures",
135삭제: "digest",
211추가: "cpufeatures 0.2.17",
212추가: "digest 0.10.7",
213추가: ]
214추가:
215추가: [[package]]
216추가: name = "sha2"
217추가: version = "0.11.1"
218추가: source = "registry+https://github.com/rust-lang/crates.io-index"
219추가: checksum = "47d7069beb7d6ac7b9acd1039986e73443f24234f41074da099d6f994ac9ad19"
220추가: dependencies = [
221추가: "cfg-if",
222추가: "cpufeatures 0.3.1",
223추가: "digest 0.11.3",
136224]
137225
138226[[package]]
@@ -164,10 +252,12 @@ name = "zipelo-archive-worker"
164252version = "0.1.0"
165253dependencies = [
166254 "aes",
255추가: "bzip2",
167256 "hmac",
257추가: "lzma-rust2",
168258 "pbkdf2",
169259 "sha1",
170삭제: "sha2",
260추가: "sha2 0.10.9",
171261 "subtle",
172262 "zeroize",
173263 "zlib-rs",
추가tests/rust-app-real-worker/compressed_tar_flows.rs+71-0
@@ -0,0 +1,71 @@
1추가: #[test]
2추가: fn compressed_tar_opens_with_native_dialog_and_extracts_to_compound_stem() {
3추가: use zipelo_ui_memory_app::archive_dialog::Purpose;
4추가: for (kind, name) in [("bz2", "여행 자료.TaR.Bz2"), ("xz", "여행 자료.tAr.XZ")] {
5추가: let scratch = Scratch::new();
6추가: let generated = std::process::Command::new("python3")
7추가: .arg(
8추가: Path::new(env!("CARGO_MANIFEST_DIR"))
9추가: .join("../../tests/rust-archive-worker/compressed_tar_cases.py"),
10추가: )
11추가: .arg(&scratch.0)
12추가: .arg(kind)
13추가: .arg("normal")
14추가: .output()
15추가: .unwrap();
16추가: assert!(
17추가: generated.status.success(),
18추가: "{}",
19추가: String::from_utf8_lossy(&generated.stderr)
20추가: );
21추가: let archive = scratch.path(name);
22추가: fs::rename(scratch.path("input"), &archive).unwrap();
23추가: let original = fs::read(&archive).unwrap();
24추가: let (factory, observed) = observed_factory();
25추가: let mut screen = Screen::new(factory);
26추가: screen
27추가: .dialogs
28추가: .0
29추가: .borrow_mut()
30추가: .answers
31추가: .push_back(Some(vec![archive.clone()]));
32추가: screen.click("열기");
33추가: screen.settle();
34추가: assert_eq!(screen.dialogs.0.borrow().requests[0].purpose, Purpose::Open);
35추가: assert_eq!(
36추가: screen.app.model.list_id.as_ref().unwrap().format,
37추가: Format::Tar
38추가: );
39추가: assert!(
40추가: screen
41추가: .app
42추가: .model
43추가: .entries
44추가: .iter()
45추가: .any(|e| e.name == "한글.txt")
46추가: );
47추가: assert!(screen.app.begin_extract());
48추가: screen.settle();
49추가: let output = scratch.path("여행 자료");
50추가: assert_eq!(
51추가: fs::read(output.join("folder/payload.bin")).unwrap(),
52추가: fs::read(scratch.path("expected")).unwrap()
53추가: );
54추가: assert_eq!(fs::read(output.join("한글.txt")).unwrap(), b"end");
55추가: assert!(output.join("empty").is_dir());
56추가: assert_eq!(fs::read(&archive).unwrap(), original);
57추가: assert!(
58추가: matches!(observed.borrow().starts.last(), Some(Start::Extract {
59추가: destination, gzip_output_name: None, ..
60추가: }) if destination == &output)
61추가: );
62추가: let labels = screen
63추가: .render(vec![])
64추가: .into_iter()
65추가: .map(|(s, _)| s)
66추가: .collect::<Vec<_>>()
67추가: .join("\n");
68추가: assert!(labels.contains("압축을 풀었습니다"), "{labels}");
69추가: assert_reaped(&observed);
70추가: }
71추가: }
수정tests/rust-app-real-worker/flows.rs+1-0
@@ -311,6 +311,7 @@ mod screen {
311311 include!("password_flows.rs");
312312 include!("selection_flows.rs");
313313 include!("native_dialog_flows.rs");
314추가: include!("compressed_tar_flows.rs");
314315
315316 fn archive_flow(name: &str, format: Format) {
316317 let scratch = Scratch::new();
수정tests/rust-app-ui/native_dialogs.rs+15-5
@@ -17,11 +17,21 @@ fn archive_filter_contains_every_case_variant_and_all_files_option() {
1717 .into_iter()
1818 .map(str::to_owned)
1919 .collect::<BTreeSet<_>>();
20삭제: assert_eq!(
21삭제: filters[0].1.iter().cloned().collect::<BTreeSet<_>>(),
22삭제: expected
23삭제: );
24삭제: assert_eq!(filters[0].1.len(), expected.len());
20추가: let actual = filters[0].1.iter().cloned().collect::<BTreeSet<_>>();
21추가: assert!(expected.is_subset(&actual));
22추가: for extension in [
23추가: "tar.bz2", "TAR.BZ2", "TaR.bZ2", "tar.xz", "TAR.XZ", "tAr.Xz",
24추가: ] {
25추가: assert!(actual.contains(extension), "{extension}");
26추가: }
27추가: assert_eq!(actual.len(), expected.len() + 64);
28추가: assert_eq!(filters[0].1.len(), actual.len());
29추가: for extension in actual.difference(&expected) {
30추가: assert!(matches!(
31추가: extension.to_ascii_lowercase().as_str(),
32추가: "tar.bz2" | "tar.xz"
33추가: ));
34추가: }
2535 assert_eq!(filters[1], ("모든 파일", vec!["*".to_owned()]));
2636}
2737
수정tests/rust-app-ui/presentation.rs+12-1
@@ -320,7 +320,18 @@ fn duplicate_names_prevent_file_completion_assumptions() {
320320}
321321#[test]
322322fn default_names_and_middle_truncation_preserve_unicode() {
323삭제: assert_eq!(default_destination(&path("자료.tar.gz")), path("자료"));
323추가: for name in [
324추가: "자료.tar.gz",
325추가: "자료.tar.bz2",
326추가: "자료.TAR.BZ2",
327추가: "자료.TaR.xZ",
328추가: "자료.tar.xz",
329추가: ] {
330추가: assert_eq!(default_destination(&path(name)), path("자료"));
331추가: }
332추가: for name in [".tar.bz2", ".TAR.XZ"] {
333추가: assert_eq!(default_destination(&path(name)), path("압축 해제"));
334추가: }
324335 assert_eq!(default_destination(&path("자료.zip")), path("자료"));
325336 assert_eq!(middle_text("가나다라마바사아자차", 7), "가나다…아자차");
326337 assert_eq!(bytes_text(21), "21 B");
수정tests/rust-app-ui/scenario_tests.rs+9-1
@@ -96,7 +96,8 @@ fn every_listed_scenario_draws_and_keeps_its_expected_screen() {
9696 );
9797 assert!(app.model.input_error.is_none(), "{}", scenario.name);
9898 let expected = match scenario.name {
99삭제: "empty" => "압축파일",
99추가: "empty" => "TAR.BZ2, TAR.XZ",
100추가: "tar-bz2" | "tar-xz" => "읽어주세요.txt",
100101 "folder-empty" => "이 폴더는 비어 있습니다",
101102 "dialog-error" => "파일 선택 창을 열 수 없습니다",
102103 "extract-partial" => "일부 파일만 풀렸습니다",
@@ -119,6 +120,13 @@ fn every_listed_scenario_draws_and_keeps_its_expected_screen() {
119120 _ => "읽어주세요.txt",
120121 };
121122 assert!(labels.contains(expected), "{}: {labels}", scenario.name);
123추가: if matches!(scenario.name, "tar-bz2" | "tar-xz") {
124추가: assert!(app.model.entries.iter().all(|entry| !entry.encrypted));
125추가: assert_eq!(
126추가: app.model.list_id.as_ref().unwrap().format,
127추가: zipelo_ui_memory_app::archive_ui::Format::Tar
128추가: );
129추가: }
122130 if scenario.name == "many-items" {
123131 assert_eq!(app.model.entries.len(), 505);
124132 }
수정tests/rust-app-ui/scenarios.rs+16-4
@@ -23,6 +23,8 @@ macro_rules! catalog {
2323catalog! {
2424 "empty" => "빈 첫 화면",
2525 "archive" => "폴더와 파일이 있는 압축파일",
26추가: "tar-bz2" => "TAR.BZ2 목록과 자동 해제 폴더",
27추가: "tar-xz" => "TAR.XZ 목록과 자동 해제 폴더",
2628 "folder" => "사진 하위 폴더",
2729 "many-items" => "500개 항목과 세로 스크롤",
2830 "selection" => "여러 파일과 폴더 선택",
@@ -162,10 +164,11 @@ impl Scenario {
162164 if self.name == "empty" {
163165 return app;
164166 }
165삭제: let archive = base.join(if self.name == "gzip-conflict" {
166삭제: "여행 자료.gz"
167삭제: } else {
168삭제: "여행 자료.zip"
167추가: let archive = base.join(match self.name {
168추가: "gzip-conflict" => "여행 자료.gz",
169추가: "tar-bz2" => "여행 자료.TAR.BZ2",
170추가: "tar-xz" => "여행 자료.TaR.Xz",
171추가: _ => "여행 자료.zip",
169172 });
170173 app.model.archive = Some(archive.clone());
171174 app.model.entries = entries(self.name == "many-items");
@@ -181,6 +184,15 @@ impl Scenario {
181184 });
182185 app.model.confirmed = true;
183186 match self.name {
187추가: "tar-bz2" | "tar-xz" => {
188추가: app.model.list_id.as_mut().unwrap().format = Format::Tar;
189추가: for entry in &mut app.model.entries {
190추가: entry.encrypted = false;
191추가: }
192추가: app.destination = present::default_destination(&archive);
193추가: app.automatic_destination = true;
194추가: return app;
195추가: }
184196 "archive" | "many-items" => return app,
185197 "folder-empty" => {
186198 app.browse_folder("빈 폴더");
추가tests/rust-archive-worker/compressed_fault.c+29-0
@@ -0,0 +1,29 @@
1추가: #define _GNU_SOURCE
2추가: #include <dlfcn.h>
3추가: #include <errno.h>
4추가: #include <fcntl.h>
5추가: #include <stdlib.h>
6추가: #include <string.h>
7추가: #include <sys/stat.h>
8추가: #include <sys/statvfs.h>
9추가: #include <unistd.h>
10추가:
11추가: static int regular_calls;
12추가:
13추가: int fstatvfs(int fd, struct statvfs *value) {
14추가: int (*original)(int, struct statvfs *) = dlsym(RTLD_NEXT, "fstatvfs");
15추가: int result = original(fd, value);
16추가: const char *mode = getenv("ZIPELO_COMPRESSED_FAULT");
17추가: struct stat info;
18추가: if (result || !mode || fstat(fd, &info) || !S_ISREG(info.st_mode)) return result;
19추가: if (++regular_calls != 2) return result;
20추가: int marker = open(getenv("ZIPELO_COMPRESSED_MARKER"), O_CREAT | O_EXCL | O_WRONLY, 0600);
21추가: if (marker < 0) { errno = EIO; return -1; }
22추가: close(marker);
23추가: if (!strcmp(mode, "full")) { value->f_bavail = 0; return 0; }
24추가: if (!strcmp(mode, "io")) { errno = EIO; return -1; }
25추가: const char *release = getenv("ZIPELO_COMPRESSED_RELEASE");
26추가: for (int i = 0; i < 1000 && access(release, F_OK); i++) usleep(10000);
27추가: if (access(release, F_OK)) { errno = EIO; return -1; }
28추가: return result;
29추가: }
추가tests/rust-archive-worker/compressed_tar.rs+405-0
@@ -0,0 +1,405 @@
1추가: use super::*;
2추가:
3추가: fn fixture(kind: &str, case: &str) -> Scratch {
4추가: let scratch = Scratch::new();
5추가: let output = Command::new("python3")
6추가: .arg(
7추가: PathBuf::from(env!("CARGO_MANIFEST_DIR"))
8추가: .join("../../tests/rust-archive-worker/compressed_tar_cases.py"),
9추가: )
10추가: .arg(&scratch.0)
11추가: .arg(kind)
12추가: .arg(case)
13추가: .output()
14추가: .unwrap();
15추가: assert!(
16추가: output.status.success(),
17추가: "{kind}/{case}: {}",
18추가: String::from_utf8_lossy(&output.stderr)
19추가: );
20추가: scratch
21추가: }
22추가:
23추가: fn run_case(s: &Scratch, limits: Limits) -> Vec<Message> {
24추가: extract(
25추가: s,
26추가: &fs::read(s.0.join("input")).unwrap(),
27추가: None,
28추가: Selection::All,
29추가: None,
30추가: limits,
31추가: )
32추가: }
33추가:
34추가: fn no_output(s: &Scratch, events: &[Message], error: ErrorCode) {
35추가: let result = terminal(events);
36추가: assert_eq!(result.outcome, Outcome::Failed, "{events:?}");
37추가: assert_eq!(result.error, error, "{events:?}");
38추가: assert_eq!(result.created_count, 0);
39추가: assert_eq!(result.publication, Publication::None);
40추가: assert!(
41추가: !events
42추가: .iter()
43추가: .any(|event| matches!(event, Message::Output { .. }))
44추가: );
45추가: assert_eq!(fs::read_dir(s.0.join("output")).unwrap().count(), 0);
46추가: assert!(!s.0.join("escape").exists());
47추가: }
48추가:
49추가: fn normal(kind: &str, case: &str) {
50추가: let s = fixture(kind, case);
51추가: let events = run_case(&s, Limits::default());
52추가: assert_eq!(terminal(&events).outcome, Outcome::Completed, "{events:?}");
53추가: assert_eq!(
54추가: fs::read(s.0.join("output/folder/payload.bin")).unwrap(),
55추가: fs::read(s.0.join("expected")).unwrap()
56추가: );
57추가: assert_eq!(fs::read(s.0.join("output/한글.txt")).unwrap(), b"end");
58추가: assert!(s.0.join("output/empty").is_dir());
59추가: }
60추가:
61추가: #[test]
62추가: fn bzip2_reference_tar_and_concatenated_streams() {
63추가: for case in ["normal", "multi"] {
64추가: normal("bz2", case);
65추가: }
66추가: }
67추가:
68추가: #[test]
69추가: fn xz_reference_tar_checks_filters_and_concatenated_streams() {
70추가: for case in [
71추가: "normal",
72추가: "multi",
73추가: "multi-block",
74추가: "multi-block-filters",
75추가: "stored-chunks",
76추가: "padding",
77추가: "crc32",
78추가: "sha256",
79추가: "no-check",
80추가: "filters",
81추가: ] {
82추가: normal("xz", case);
83추가: }
84추가: }
85추가:
86추가: #[test]
87추가: fn compressed_empty_tar_is_valid() {
88추가: for kind in ["bz2", "xz"] {
89추가: let s = fixture(kind, "empty");
90추가: let events = run_case(&s, Limits::default());
91추가: assert_eq!(
92추가: terminal(&events).outcome,
93추가: Outcome::Completed,
94추가: "{kind}: {events:?}"
95추가: );
96추가: assert_eq!(terminal(&events).created_count, 0);
97추가: assert_eq!(fs::read_dir(s.0.join("output")).unwrap().count(), 0);
98추가: }
99추가: }
100추가:
101추가: #[test]
102추가: fn bzip2_truncation_corruption_and_trailing_data_never_publish() {
103추가: for case in [
104추가: "truncated",
105추가: "corrupt",
106추가: "trailing",
107추가: "multi-bad",
108추가: "bad-tar",
109추가: "raw",
110추가: "empty-stream",
111추가: ] {
112추가: let s = fixture("bz2", case);
113추가: let events = run_case(&s, Limits::default());
114추가: no_output(&s, &events, ErrorCode::Integrity);
115추가: }
116추가: }
117추가:
118추가: #[test]
119추가: fn xz_truncation_corruption_and_trailing_data_never_publish() {
120추가: for case in [
121추가: "truncated",
122추가: "corrupt",
123추가: "trailing",
124추가: "multi-bad",
125추가: "bad-tar",
126추가: "raw",
127추가: "empty-stream",
128추가: "bad-padding",
129추가: ] {
130추가: let s = fixture("xz", case);
131추가: let events = run_case(&s, Limits::default());
132추가: no_output(&s, &events, ErrorCode::Integrity);
133추가: }
134추가: }
135추가:
136추가: #[test]
137추가: fn xz_index_sizes_cannot_cancel_between_streams() {
138추가: let s = fixture("xz", "index-stream-sizes");
139추가: let events = run_case(&s, Limits::default());
140추가: no_output(&s, &events, ErrorCode::Integrity);
141추가: }
142추가:
143추가: #[test]
144추가: fn xz_index_sizes_cannot_cancel_between_blocks() {
145추가: let s = fixture("xz", "index-block-sizes");
146추가: let events = run_case(&s, Limits::default());
147추가: no_output(&s, &events, ErrorCode::Integrity);
148추가: }
149추가:
150추가: #[test]
151추가: fn xz_index_unpadded_sizes_must_match_each_block() {
152추가: let s = fixture("xz", "index-unpadded-sizes");
153추가: let events = run_case(&s, Limits::default());
154추가: no_output(&s, &events, ErrorCode::Integrity);
155추가: }
156추가:
157추가: #[test]
158추가: fn compressed_tar_bombs_stop_before_publication() {
159추가: for kind in ["bz2", "xz"] {
160추가: let s = fixture(kind, "bomb");
161추가: let events = run_case(
162추가: &s,
163추가: Limits {
164추가: output: 256 * 1024,
165추가: ..Limits::default()
166추가: },
167추가: );
168추가: no_output(&s, &events, ErrorCode::Limit);
169추가: }
170추가: }
171추가:
172추가: #[test]
173추가: fn xz_huge_dictionary_is_rejected_before_allocation() {
174추가: let s = fixture("xz", "dictionary");
175추가: let events = run_case(&s, Limits::default());
176추가: no_output(&s, &events, ErrorCode::Limit);
177추가: }
178추가:
179추가: #[test]
180추가: fn compressed_tar_paths_and_links_keep_existing_guards() {
181추가: for kind in ["bz2", "xz"] {
182추가: for (case, error) in [
183추가: ("unsafe", ErrorCode::UnsafePath),
184추가: ("link", ErrorCode::UnsafePath),
185추가: ] {
186추가: let s = fixture(kind, case);
187추가: let events = run_case(&s, Limits::default());
188추가: no_output(&s, &events, error);
189추가: }
190추가: }
191추가: }
192추가:
193추가: #[test]
194추가: fn compressed_tar_list_identity_and_selection() {
195추가: for kind in ["bz2", "xz"] {
196추가: let s = fixture(kind, "normal");
197추가: let events = execute(Start {
198추가: action: Action::List {
199추가: archive: s.path("input"),
200추가: },
201추가: limits: Limits::default(),
202추가: });
203추가: assert_eq!(terminal(&events).outcome, Outcome::Completed, "{events:?}");
204추가: let token = events
205추가: .iter()
206추가: .find_map(|event| match event {
207추가: Message::ListEnd { list_id, .. } => Some(list_id.clone()),
208추가: _ => None,
209추가: })
210추가: .unwrap();
211추가: assert_eq!(token.format, Format::Tar);
212추가: let bytes = fs::read(s.0.join("input")).unwrap();
213추가: let events = extract(
214추가: &s,
215추가: &bytes,
216추가: None,
217추가: Selection::EntryIds(vec![2]),
218추가: Some(token),
219추가: Limits::default(),
220추가: );
221추가: assert_eq!(terminal(&events).outcome, Outcome::Completed, "{events:?}");
222추가: assert_eq!(fs::read(s.0.join("output/한글.txt")).unwrap(), b"end");
223추가: assert!(!s.0.join("output/folder").exists());
224추가: }
225추가: }
226추가:
227추가: #[test]
228추가: fn compressed_tar_entry_quota_is_preserved() {
229추가: for kind in ["bz2", "xz"] {
230추가: let s = fixture(kind, "normal");
231추가: let events = run_case(
232추가: &s,
233추가: Limits {
234추가: entries: 1,
235추가: ..Limits::default()
236추가: },
237추가: );
238추가: no_output(&s, &events, ErrorCode::Limit);
239추가: }
240추가: }
241추가:
242추가: #[cfg(target_os = "linux")]
243추가: mod linux {
244추가: use super::*;
245추가: use std::{
246추가: io::Read,
247추가: time::{Duration, Instant},
248추가: };
249추가:
250추가: struct Running(std::process::Child);
251추가: impl Drop for Running {
252추가: fn drop(&mut self) {
253추가: let _ = self.0.kill();
254추가: let _ = self.0.wait();
255추가: }
256추가: }
257추가:
258추가: fn inject(s: &Scratch, mode: &str) -> (Running, Writer<std::process::ChildStdin>) {
259추가: let library = s.0.join("compressed_fault.so");
260추가: assert!(
261추가: Command::new("cc")
262추가: .args(["-shared", "-fPIC", "-O2", "-Wall", "-Wextra", "-Werror"])
263추가: .arg(
264추가: PathBuf::from(env!("CARGO_MANIFEST_DIR"))
265추가: .join("../../tests/rust-archive-worker/compressed_fault.c")
266추가: )
267추가: .arg("-ldl")
268추가: .arg("-o")
269추가: .arg(&library)
270추가: .status()
271추가: .unwrap()
272추가: .success()
273추가: );
274추가: let bytes = fs::read(s.0.join("input")).unwrap();
275추가: let preparation = extract(
276추가: s,
277추가: &bytes,
278추가: None,
279추가: Selection::EntryIds(vec![999]),
280추가: None,
281추가: Limits::default(),
282추가: );
283추가: assert_ne!(terminal(&preparation).outcome, Outcome::Completed);
284추가: let mut command = s.worker();
285추가: command
286추가: .env("LD_PRELOAD", library)
287추가: .env("ZIPELO_COMPRESSED_FAULT", mode)
288추가: .env("ZIPELO_COMPRESSED_MARKER", s.0.join("paused"))
289추가: .env("ZIPELO_COMPRESSED_RELEASE", s.0.join("release"))
290추가: .stdin(Stdio::piped())
291추가: .stdout(Stdio::piped())
292추가: .stderr(Stdio::piped());
293추가: let mut child = command.spawn().unwrap();
294추가: let mut writer = Writer::new(child.stdin.take().unwrap(), 17);
295추가: writer
296추가: .send(&Message::Start(Start {
297추가: action: Action::Extract {
298추가: archive: s.path("input"),
299추가: destination: s.path("output"),
300추가: selection: Selection::All,
301추가: list_id: None,
302추가: gzip_output_name: None,
303추가: },
304추가: limits: Limits::default(),
305추가: }))
306추가: .unwrap();
307추가: (Running(child), writer)
308추가: }
309추가:
310추가: fn finish(child: &mut Running) -> Vec<Message> {
311추가: drop(child.0.stdin.take());
312추가: let mut out = child.0.stdout.take().unwrap();
313추가: let mut err = child.0.stderr.take().unwrap();
314추가: let mut bytes = Vec::new();
315추가: out.read_to_end(&mut bytes).unwrap();
316추가: let mut errors = Vec::new();
317추가: err.read_to_end(&mut errors).unwrap();
318추가: assert!(child.0.wait().unwrap().success());
319추가: assert!(errors.is_empty(), "{errors:?}");
320추가: let mut reader = Reader::new(bytes.as_slice());
321추가: let mut events = Vec::new();
322추가: while let Some((_, _, event)) = reader.read().unwrap() {
323추가: events.push(event);
324추가: }
325추가: events
326추가: }
327추가:
328추가: #[test]
329추가: fn compressed_tar_codec_space_failure_never_publishes() {
330추가: for kind in ["bz2", "xz"] {
331추가: for (mode, error) in [("full", ErrorCode::DiskFull), ("io", ErrorCode::Io)] {
332추가: let s = fixture(kind, "normal");
333추가: let (mut child, writer) = inject(&s, mode);
334추가: drop(writer);
335추가: let events = finish(&mut child);
336추가: assert!(s.0.join("paused").exists());
337추가: no_output(&s, &events, error);
338추가: }
339추가: }
340추가: }
341추가:
342추가: #[test]
343추가: fn compressed_tar_cancels_during_decode_and_cleans_staging() {
344추가: for kind in ["bz2", "xz"] {
345추가: let s = fixture(kind, "normal");
346추가: let (mut child, mut writer) = inject(&s, "pause");
347추가: let deadline = Instant::now() + Duration::from_secs(10);
348추가: while !s.0.join("paused").exists() {
349추가: assert!(Instant::now() < deadline, "decoder did not pause");
350추가: std::thread::sleep(Duration::from_millis(5));
351추가: }
352추가: writer.send(&Message::Cancel).unwrap();
353추가: drop(writer);
354추가: std::thread::sleep(Duration::from_millis(25));
355추가: fs::write(s.0.join("release"), b"").unwrap();
356추가: let events = finish(&mut child);
357추가: assert_eq!(terminal(&events).outcome, Outcome::Cancelled, "{events:?}");
358추가: assert_eq!(terminal(&events).created_count, 0);
359추가: assert_eq!(fs::read_dir(s.0.join("output")).unwrap().count(), 0);
360추가: assert!(
361추가: !events
362추가: .iter()
363추가: .any(|event| matches!(event, Message::Output { .. }))
364추가: );
365추가: }
366추가: }
367추가: }
368추가:
369추가: #[test]
370추가: fn xz_index_and_footer_claims_are_checked_before_publication() {
371추가: for (case, error) in [
372추가: ("index-size", ErrorCode::Integrity),
373추가: ("footer-offset", ErrorCode::Integrity),
374추가: ("index-huge", ErrorCode::Limit),
375추가: ] {
376추가: let s = fixture("xz", case);
377추가: let events = run_case(&s, Limits::default());
378추가: no_output(&s, &events, error);
379추가: }
380추가: }
381추가:
382추가: #[test]
383추가: fn compressed_tar_output_quota_boundary() {
384추가: for kind in ["bz2", "xz"] {
385추가: for below in [false, true] {
386추가: let s = fixture(kind, "normal");
387추가: let size: u64 = fs::read_to_string(s.0.join("plain-size"))
388추가: .unwrap()
389추가: .parse()
390추가: .unwrap();
391추가: let events = run_case(
392추가: &s,
393추가: Limits {
394추가: output: size - u64::from(below),
395추가: ..Limits::default()
396추가: },
397추가: );
398추가: if below {
399추가: no_output(&s, &events, ErrorCode::Limit);
400추가: } else {
401추가: assert_eq!(terminal(&events).outcome, Outcome::Completed, "{events:?}");
402추가: }
403추가: }
404추가: }
405추가: }
추가tests/rust-archive-worker/compressed_tar_cases.py+192-0
@@ -0,0 +1,192 @@
1추가: import bz2
2추가: import hashlib
3추가: import io
4추가: import lzma
5추가: from pathlib import Path
6추가: import random
7추가: import sys
8추가: import tarfile
9추가: import zlib
10추가:
11추가:
12추가: root = Path(sys.argv[1])
13추가: kind = sys.argv[2]
14추가: case = sys.argv[3]
15추가: payload = bytes(range(251)) * 1800
16추가: if case == "bomb":
17추가: payload = bytes(8 * 1024 * 1024)
18추가: elif case == "stored-chunks":
19추가: payload = random.Random(42).randbytes(len(payload))
20추가: buffer = io.BytesIO()
21추가: with tarfile.open(fileobj=buffer, mode="w", format=tarfile.USTAR_FORMAT) as archive:
22추가: if case != "empty":
23추가: name = "../escape" if case == "unsafe" else "folder/payload.bin"
24추가: member = tarfile.TarInfo(name)
25추가: member.size = len(payload)
26추가: archive.addfile(member, io.BytesIO(payload))
27추가: if case == "link":
28추가: member = tarfile.TarInfo("link")
29추가: member.type = tarfile.SYMTYPE
30추가: member.linkname = "folder/payload.bin"
31추가: archive.addfile(member)
32추가: member = tarfile.TarInfo("empty/")
33추가: member.type = tarfile.DIRTYPE
34추가: archive.addfile(member)
35추가: member = tarfile.TarInfo("한글.txt")
36추가: member.size = 3
37추가: archive.addfile(member, io.BytesIO(b"end"))
38추가: plain = buffer.getvalue()
39추가: if case == "bad-tar":
40추가: plain = bytes([plain[0] ^ 1]) + plain[1:]
41추가: if case == "raw":
42추가: plain = b"not a tar archive"
43추가: if case == "empty-stream":
44추가: plain = b""
45추가:
46추가: def compress(data):
47추가: if kind == "bz2":
48추가: return bz2.compress(data)
49추가: check = {
50추가: "crc32": lzma.CHECK_CRC32,
51추가: "sha256": lzma.CHECK_SHA256,
52추가: "no-check": lzma.CHECK_NONE,
53추가: }.get(case, lzma.CHECK_CRC64)
54추가: filters = None
55추가: if case in ("filters", "multi-block-filters"):
56추가: filters = [
57추가: {"id": lzma.FILTER_X86},
58추가: {"id": lzma.FILTER_DELTA, "dist": 3},
59추가: {"id": lzma.FILTER_LZMA2, "dict_size": 1 << 20},
60추가: ]
61추가: return lzma.compress(data, check=check, filters=filters)
62추가:
63추가:
64추가: def encode_vli(value):
65추가: result = bytearray()
66추가: while value >= 128:
67추가: result.append((value & 127) | 128)
68추가: value >>= 7
69추가: result.append(value)
70추가: return result
71추가:
72추가:
73추가: def read_vli(data, cursor):
74추가: value = 0
75추가: shift = 0
76추가: while True:
77추가: byte = data[cursor]
78추가: cursor += 1
79추가: value |= (byte & 127) << shift
80추가: if byte < 128:
81추가: return value, cursor
82추가: shift += 7
83추가:
84추가:
85추가: def xz_blocks(parts, deltas=None, shift_unpadded=False):
86추가: streams = [compress(part) for part in parts]
87추가: blocks = bytearray()
88추가: index = bytearray([0]) + encode_vli(len(streams))
89추가: for number, stream in enumerate(streams):
90추가: length = (int.from_bytes(stream[-8:-4], "little") + 1) * 4
91추가: start = len(stream) - 12 - length
92추가: count, cursor = read_vli(stream, start + 1)
93추가: assert count == 1
94추가: unpadded, cursor = read_vli(stream, cursor)
95추가: size, _ = read_vli(stream, cursor)
96추가: blocks.extend(stream[12:start])
97추가: unpadded_delta, size_delta = deltas[number] if deltas else (0, 0)
98추가: if shift_unpadded and number == 0:
99추가: unpadded_delta = 1 if unpadded % 4 else -1
100추가: assert (unpadded + 3) // 4 == (unpadded + unpadded_delta + 3) // 4
101추가: index.extend(encode_vli(unpadded + unpadded_delta))
102추가: index.extend(encode_vli(size + size_delta))
103추가: index.extend(bytes(-len(index) % 4))
104추가: index.extend(zlib.crc32(index).to_bytes(4, "little"))
105추가: footer = (len(index) // 4 - 1).to_bytes(4, "little") + streams[0][6:8]
106추가: footer = zlib.crc32(footer).to_bytes(4, "little") + footer + b"YZ"
107추가: return streams[0][:12] + blocks + index + footer
108추가:
109추가:
110추가: index_cases = {
111추가: "index-stream-sizes", "index-block-sizes", "index-unpadded-sizes",
112추가: }
113추가: if kind == "xz" and case in index_cases | {"multi-block", "multi-block-filters"}:
114추가: half = len(plain) // 2
115추가: parts = [plain[:half], plain[half:]]
116추가: if case == "index-stream-sizes":
117추가: packed = xz_blocks(parts[:1], [(0, 1)]) + xz_blocks(parts[1:], [(0, -1)])
118추가: elif case == "index-block-sizes":
119추가: packed = xz_blocks(parts, [(0, 1), (0, -1)])
120추가: elif case == "index-unpadded-sizes":
121추가: packed = xz_blocks(parts, shift_unpadded=True)
122추가: else:
123추가: packed = xz_blocks(parts)
124추가: if case in index_cases:
125추가: try:
126추가: lzma.decompress(packed)
127추가: except lzma.LZMAError:
128추가: pass
129추가: else:
130추가: raise AssertionError("참조 디코더가 손상 인덱스를 허용함")
131추가: elif case in ("multi", "multi-bad", "padding"):
132추가: half = len(plain) // 2
133추가: padding = bytes(4) if kind == "xz" and case == "padding" else b""
134추가: packed = compress(plain[:half]) + padding + compress(plain[half:]) + padding
135추가: else:
136추가: packed = compress(plain)
137추가: if case == "truncated":
138추가: packed = packed[:-5]
139추가: elif case == "multi-bad":
140추가: packed = packed[:-5]
141추가: elif case == "corrupt":
142추가: at = len(packed) // 2
143추가: packed = packed[:at] + bytes([packed[at] ^ 128]) + packed[at + 1:]
144추가: elif case == "trailing":
145추가: packed += b"garbage"
146추가: elif case == "dictionary":
147추가: packed = bytearray(packed)
148추가: header_end = 12 + (packed[12] + 1) * 4
149추가: assert packed[14:16] == b"\x21\x01"
150추가: packed[16] = 40
151추가: packed[header_end - 4:header_end] = zlib.crc32(packed[12:header_end - 4]).to_bytes(4, "little")
152추가: packed = bytes(packed)
153추가: elif case == "bad-padding":
154추가: packed += b"\0"
155추가: if case in ("index-size", "footer-offset", "index-huge"):
156추가: packed = bytearray(packed)
157추가: if case == "index-size":
158추가: length = (int.from_bytes(packed[-8:-4], "little") + 1) * 4
159추가: index = len(packed) - 12 - length
160추가: cursor = index + 2
161추가: while packed[cursor] & 128:
162추가: cursor += 1
163추가: cursor += 1
164추가: packed[cursor] ^= 1
165추가: packed[-16:-12] = zlib.crc32(packed[index:-16]).to_bytes(4, "little")
166추가: else:
167추가: size = int.from_bytes(packed[-8:-4], "little") + 1
168추가: if case == "index-huge":
169추가: size = (8 * 1024 * 1024) // 4
170추가: packed[-8:-4] = size.to_bytes(4, "little")
171추가: packed[-12:-8] = zlib.crc32(packed[-8:-2]).to_bytes(4, "little")
172추가: packed = bytes(packed)
173추가: (root / "plain-size").write_text(str(len(plain)))
174추가: (root / "input").write_bytes(packed)
175추가: if case in (
176추가: "normal", "multi", "multi-block", "multi-block-filters", "stored-chunks",
177추가: "padding", "crc32", "sha256", "no-check", "filters",
178추가: ):
179추가: decoded = bz2.decompress(packed) if kind == "bz2" else lzma.decompress(packed)
180추가: if case == "padding":
181추가: decoded = b""
182추가: remaining = packed
183추가: while remaining:
184추가: part = lzma.LZMADecompressor()
185추가: decoded += part.decompress(remaining)
186추가: assert part.eof
187추가: remaining = part.unused_data.lstrip(bytes(1))
188추가: assert decoded == plain, case
189추가: with tarfile.open(fileobj=io.BytesIO(decoded), mode="r:") as archive:
190추가: actual = archive.extractfile("folder/payload.bin").read()
191추가: assert hashlib.sha256(actual).digest() == hashlib.sha256(payload).digest()
192추가: (root / "expected").write_bytes(actual)
수정tests/rust-archive-worker/main.rs+2-0
@@ -1613,3 +1613,5 @@ mod zip_names;
16131613mod conflict_wire;
16141614
16151615mod conflicts;
1616추가:
1617추가: mod compressed_tar;
수정tests/rust-large-archive-fixtures/Cargo.lock+101-11
@@ -10,7 +10,7 @@ checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0"
1010dependencies = [
1111 "cfg-if",
1212 "cipher",
13삭제: "cpufeatures",
13추가: "cpufeatures 0.2.17",
1414 "zeroize",
1515]
1616
@@ -23,6 +23,24 @@ dependencies = [
2323 "generic-array",
2424]
2525
26추가: [[package]]
27추가: name = "block-buffer"
28추가: version = "0.12.1"
29추가: source = "registry+https://github.com/rust-lang/crates.io-index"
30추가: checksum = "d2f6c7dbe95a6ed67ad9f18e57daf93a2f034c524b99fd2b76d18fdfeb6660aa"
31추가: dependencies = [
32추가: "hybrid-array",
33추가: ]
34추가:
35추가: [[package]]
36추가: name = "bzip2"
37추가: version = "0.6.1"
38추가: source = "registry+https://github.com/rust-lang/crates.io-index"
39추가: checksum = "f3a53fac24f34a81bc9954b5d6cfce0c21e18ec6959f44f56e8e90e4bb7c346c"
40추가: dependencies = [
41추가: "libbz2-rs-sys",
42추가: ]
43추가:
2644[[package]]
2745name = "cfg-if"
2846version = "1.0.5"
@@ -35,10 +53,16 @@ version = "0.4.4"
3553source = "registry+https://github.com/rust-lang/crates.io-index"
3654checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"
3755dependencies = [
38삭제: "crypto-common",
56추가: "crypto-common 0.1.7",
3957 "inout",
4058]
4159
60추가: [[package]]
61추가: name = "const-oid"
62추가: version = "0.10.3"
63추가: source = "registry+https://github.com/rust-lang/crates.io-index"
64추가: checksum = "be95d4a884358a21a199689323c29e9256b4a1b315e22f183d155422041d3a9a"
65추가:
4266[[package]]
4367name = "cpufeatures"
4468version = "0.2.17"
@@ -48,6 +72,15 @@ dependencies = [
4872 "libc",
4973]
5074
75추가: [[package]]
76추가: name = "cpufeatures"
77추가: version = "0.3.1"
78추가: source = "registry+https://github.com/rust-lang/crates.io-index"
79추가: checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566"
80추가: dependencies = [
81추가: "libc",
82추가: ]
83추가:
5184[[package]]
5285name = "crypto-common"
5386version = "0.1.7"
@@ -58,17 +91,37 @@ dependencies = [
5891 "typenum",
5992]
6093
94추가: [[package]]
95추가: name = "crypto-common"
96추가: version = "0.2.2"
97추가: source = "registry+https://github.com/rust-lang/crates.io-index"
98추가: checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453"
99추가: dependencies = [
100추가: "hybrid-array",
101추가: ]
102추가:
61103[[package]]
62104name = "digest"
63105version = "0.10.7"
64106source = "registry+https://github.com/rust-lang/crates.io-index"
65107checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
66108dependencies = [
67삭제: "block-buffer",
68삭제: "crypto-common",
109추가: "block-buffer 0.10.4",
110추가: "crypto-common 0.1.7",
69111 "subtle",
70112]
71113
114추가: [[package]]
115추가: name = "digest"
116추가: version = "0.11.3"
117추가: source = "registry+https://github.com/rust-lang/crates.io-index"
118추가: checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2"
119추가: dependencies = [
120추가: "block-buffer 0.12.1",
121추가: "const-oid",
122추가: "crypto-common 0.2.2",
123추가: ]
124추가:
72125[[package]]
73126name = "generic-array"
74127version = "0.14.7"
@@ -85,7 +138,16 @@ version = "0.12.1"
85138source = "registry+https://github.com/rust-lang/crates.io-index"
86139checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"
87140dependencies = [
88삭제: "digest",
141추가: "digest 0.10.7",
142추가: ]
143추가:
144추가: [[package]]
145추가: name = "hybrid-array"
146추가: version = "0.4.15"
147추가: source = "registry+https://github.com/rust-lang/crates.io-index"
148추가: checksum = "27f864f10dfb56725ce5ce5472bc52252c8f93a4ab86327122cebf62c5f59a17"
149추가: dependencies = [
150추가: "typenum",
89151]
90152
91153[[package]]
@@ -97,19 +159,34 @@ dependencies = [
97159 "generic-array",
98160]
99161
162추가: [[package]]
163추가: name = "libbz2-rs-sys"
164추가: version = "0.2.6"
165추가: source = "registry+https://github.com/rust-lang/crates.io-index"
166추가: checksum = "32f454fd6831a29c0e827ed075bca2a15be201bd57f4168f0fd1041124eab17e"
167추가:
100168[[package]]
101169name = "libc"
102170version = "0.2.191"
103171source = "registry+https://github.com/rust-lang/crates.io-index"
104172checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
105173
174추가: [[package]]
175추가: name = "lzma-rust2"
176추가: version = "0.25.0"
177추가: source = "registry+https://github.com/rust-lang/crates.io-index"
178추가: checksum = "ef1d73c59a56771343712b22ea5615092c612c16ba291c0979e3105dfeec4890"
179추가: dependencies = [
180추가: "sha2 0.11.1",
181추가: ]
182추가:
106183[[package]]
107184name = "pbkdf2"
108185version = "0.12.2"
109186source = "registry+https://github.com/rust-lang/crates.io-index"
110187checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2"
111188dependencies = [
112삭제: "digest",
189추가: "digest 0.10.7",
113190 "hmac",
114191]
115192
@@ -120,8 +197,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
120197checksum = "a978451301f4db1d02937a4ab3ccce137717b81826e79b7d49ffe3244a13c3b8"
121198dependencies = [
122199 "cfg-if",
123삭제: "cpufeatures",
124삭제: "digest",
200추가: "cpufeatures 0.2.17",
201추가: "digest 0.10.7",
125202]
126203
127204[[package]]
@@ -131,8 +208,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
131208checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
132209dependencies = [
133210 "cfg-if",
134삭제: "cpufeatures",
135삭제: "digest",
211추가: "cpufeatures 0.2.17",
212추가: "digest 0.10.7",
213추가: ]
214추가:
215추가: [[package]]
216추가: name = "sha2"
217추가: version = "0.11.1"
218추가: source = "registry+https://github.com/rust-lang/crates.io-index"
219추가: checksum = "47d7069beb7d6ac7b9acd1039986e73443f24234f41074da099d6f994ac9ad19"
220추가: dependencies = [
221추가: "cfg-if",
222추가: "cpufeatures 0.3.1",
223추가: "digest 0.11.3",
136224]
137225
138226[[package]]
@@ -164,10 +252,12 @@ name = "zipelo-archive-worker"
164252version = "0.1.0"
165253dependencies = [
166254 "aes",
255추가: "bzip2",
167256 "hmac",
257추가: "lzma-rust2",
168258 "pbkdf2",
169259 "sha1",
170삭제: "sha2",
260추가: "sha2 0.10.9",
171261 "subtle",
172262 "zeroize",
173263 "zlib-rs",
수정tests/rust-zip64-compat/Cargo.lock+101-11
@@ -10,7 +10,7 @@ checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0"
1010dependencies = [
1111 "cfg-if",
1212 "cipher",
13삭제: "cpufeatures",
13추가: "cpufeatures 0.2.17",
1414 "zeroize",
1515]
1616
@@ -23,6 +23,24 @@ dependencies = [
2323 "generic-array",
2424]
2525
26추가: [[package]]
27추가: name = "block-buffer"
28추가: version = "0.12.1"
29추가: source = "registry+https://github.com/rust-lang/crates.io-index"
30추가: checksum = "d2f6c7dbe95a6ed67ad9f18e57daf93a2f034c524b99fd2b76d18fdfeb6660aa"
31추가: dependencies = [
32추가: "hybrid-array",
33추가: ]
34추가:
35추가: [[package]]
36추가: name = "bzip2"
37추가: version = "0.6.1"
38추가: source = "registry+https://github.com/rust-lang/crates.io-index"
39추가: checksum = "f3a53fac24f34a81bc9954b5d6cfce0c21e18ec6959f44f56e8e90e4bb7c346c"
40추가: dependencies = [
41추가: "libbz2-rs-sys",
42추가: ]
43추가:
2644[[package]]
2745name = "cfg-if"
2846version = "1.0.5"
@@ -35,10 +53,16 @@ version = "0.4.4"
3553source = "registry+https://github.com/rust-lang/crates.io-index"
3654checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"
3755dependencies = [
38삭제: "crypto-common",
56추가: "crypto-common 0.1.7",
3957 "inout",
4058]
4159
60추가: [[package]]
61추가: name = "const-oid"
62추가: version = "0.10.3"
63추가: source = "registry+https://github.com/rust-lang/crates.io-index"
64추가: checksum = "be95d4a884358a21a199689323c29e9256b4a1b315e22f183d155422041d3a9a"
65추가:
4266[[package]]
4367name = "cpufeatures"
4468version = "0.2.17"
@@ -48,6 +72,15 @@ dependencies = [
4872 "libc",
4973]
5074
75추가: [[package]]
76추가: name = "cpufeatures"
77추가: version = "0.3.1"
78추가: source = "registry+https://github.com/rust-lang/crates.io-index"
79추가: checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566"
80추가: dependencies = [
81추가: "libc",
82추가: ]
83추가:
5184[[package]]
5285name = "crypto-common"
5386version = "0.1.7"
@@ -58,17 +91,37 @@ dependencies = [
5891 "typenum",
5992]
6093
94추가: [[package]]
95추가: name = "crypto-common"
96추가: version = "0.2.2"
97추가: source = "registry+https://github.com/rust-lang/crates.io-index"
98추가: checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453"
99추가: dependencies = [
100추가: "hybrid-array",
101추가: ]
102추가:
61103[[package]]
62104name = "digest"
63105version = "0.10.7"
64106source = "registry+https://github.com/rust-lang/crates.io-index"
65107checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
66108dependencies = [
67삭제: "block-buffer",
68삭제: "crypto-common",
109추가: "block-buffer 0.10.4",
110추가: "crypto-common 0.1.7",
69111 "subtle",
70112]
71113
114추가: [[package]]
115추가: name = "digest"
116추가: version = "0.11.3"
117추가: source = "registry+https://github.com/rust-lang/crates.io-index"
118추가: checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2"
119추가: dependencies = [
120추가: "block-buffer 0.12.1",
121추가: "const-oid",
122추가: "crypto-common 0.2.2",
123추가: ]
124추가:
72125[[package]]
73126name = "generic-array"
74127version = "0.14.7"
@@ -85,7 +138,16 @@ version = "0.12.1"
85138source = "registry+https://github.com/rust-lang/crates.io-index"
86139checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"
87140dependencies = [
88삭제: "digest",
141추가: "digest 0.10.7",
142추가: ]
143추가:
144추가: [[package]]
145추가: name = "hybrid-array"
146추가: version = "0.4.15"
147추가: source = "registry+https://github.com/rust-lang/crates.io-index"
148추가: checksum = "27f864f10dfb56725ce5ce5472bc52252c8f93a4ab86327122cebf62c5f59a17"
149추가: dependencies = [
150추가: "typenum",
89151]
90152
91153[[package]]
@@ -97,19 +159,34 @@ dependencies = [
97159 "generic-array",
98160]
99161
162추가: [[package]]
163추가: name = "libbz2-rs-sys"
164추가: version = "0.2.6"
165추가: source = "registry+https://github.com/rust-lang/crates.io-index"
166추가: checksum = "32f454fd6831a29c0e827ed075bca2a15be201bd57f4168f0fd1041124eab17e"
167추가:
100168[[package]]
101169name = "libc"
102170version = "0.2.191"
103171source = "registry+https://github.com/rust-lang/crates.io-index"
104172checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
105173
174추가: [[package]]
175추가: name = "lzma-rust2"
176추가: version = "0.25.0"
177추가: source = "registry+https://github.com/rust-lang/crates.io-index"
178추가: checksum = "ef1d73c59a56771343712b22ea5615092c612c16ba291c0979e3105dfeec4890"
179추가: dependencies = [
180추가: "sha2 0.11.1",
181추가: ]
182추가:
106183[[package]]
107184name = "pbkdf2"
108185version = "0.12.2"
109186source = "registry+https://github.com/rust-lang/crates.io-index"
110187checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2"
111188dependencies = [
112삭제: "digest",
189추가: "digest 0.10.7",
113190 "hmac",
114191]
115192
@@ -120,8 +197,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
120197checksum = "a978451301f4db1d02937a4ab3ccce137717b81826e79b7d49ffe3244a13c3b8"
121198dependencies = [
122199 "cfg-if",
123삭제: "cpufeatures",
124삭제: "digest",
200추가: "cpufeatures 0.2.17",
201추가: "digest 0.10.7",
125202]
126203
127204[[package]]
@@ -131,8 +208,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
131208checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
132209dependencies = [
133210 "cfg-if",
134삭제: "cpufeatures",
135삭제: "digest",
211추가: "cpufeatures 0.2.17",
212추가: "digest 0.10.7",
213추가: ]
214추가:
215추가: [[package]]
216추가: name = "sha2"
217추가: version = "0.11.1"
218추가: source = "registry+https://github.com/rust-lang/crates.io-index"
219추가: checksum = "47d7069beb7d6ac7b9acd1039986e73443f24234f41074da099d6f994ac9ad19"
220추가: dependencies = [
221추가: "cfg-if",
222추가: "cpufeatures 0.3.1",
223추가: "digest 0.11.3",
136224]
137225
138226[[package]]
@@ -164,10 +252,12 @@ name = "zipelo-archive-worker"
164252version = "0.1.0"
165253dependencies = [
166254 "aes",
255추가: "bzip2",
167256 "hmac",
257추가: "lzma-rust2",
168258 "pbkdf2",
169259 "sha1",
170삭제: "sha2",
260추가: "sha2 0.10.9",
171261 "subtle",
172262 "zeroize",
173263 "zlib-rs",