diff --git a/README.md b/README.md index b217264..618debb 100644 --- a/README.md +++ b/README.md @@ -112,6 +112,7 @@ Vite `?url` import 로 로드됩니다. | `dist2` 정적 빌드 배포 절차 (공식 배포 스크립트 없음) | [`docs/deploy-dist2-static-build.md`](./docs/deploy-dist2-static-build.md) | | SubDMesh(MESH) 미표시 — parseResult 누락 + 큰 메쉬 잘림 | [`docs/subdmesh-rendering.md`](./docs/subdmesh-rendering.md) | | 선가중치(Lineweight) 미적용 — parseResult 누락 + WebGL 1px 한계 | [`docs/lineweight-rendering.md`](./docs/lineweight-rendering.md) | +| acadrust MPL-2.0 고지 누락 (수정본 wasm 공개 배포) | [`docs/license-mpl2-acadrust.md`](./docs/license-mpl2-acadrust.md) | | ↳ 위 둘의 측정 결과 + 상호작용(메쉬 선분이 굵기 버킷 상한을 넘길 위험) | [`docs/improvement-results-2026-08-04.md`](./docs/improvement-results-2026-08-04.md) | 샘플 패치: `fixDwgKoreanText`, `cadSpaces` + Viewer2D 공간 필터, Model/Layout 탭. @@ -124,6 +125,11 @@ Vite `?url` import 로 로드됩니다. | 조각 | 라이선스 | |------|----------| | Viewer2D 포트 · 샘플 글루 | MIT (hmwebviewer 계열) | -| acadrust (WASM 내부, `read_mesh` 로컬 패치 포함) | MPL-2.0 | -| dxf-parser · three | MIT | +| acadrust (WASM 내부, `read_mesh` 로컬 패치 포함) | **MPL-2.0 — 수정본** | +| dxf-parser · three · opentype.js | MIT | | NanumGothic | OFL | + +acadrust 는 파일 단위 카피레프트라 **패치한 파일의 소스를 배포 대상자에게 제공할 의무**가 +있다. 고지·MPL 원문·패치는 [`THIRD-PARTY-NOTICES.md`](./THIRD-PARTY-NOTICES.md) 와 +`public/licenses/`(배포 시 `/licenses/`)에 동봉한다. +의무 범위와 조치 근거: [`docs/license-mpl2-acadrust.md`](./docs/license-mpl2-acadrust.md) diff --git a/THIRD-PARTY-NOTICES.md b/THIRD-PARTY-NOTICES.md new file mode 100644 index 0000000..a3ecaef --- /dev/null +++ b/THIRD-PARTY-NOTICES.md @@ -0,0 +1,70 @@ +# Third-party notices + +This viewer bundles third-party code. The notices below apply to the source +tree **and** to the built site (`dist2/`, deployed at +`https://dwg-dxf-viewer-sample.pages.dev/`), because the build embeds the +components listed here. + +Served copies of the license texts live under +[`public/licenses/`](./public/licenses/) → `/licenses/…` on the deployed site. + +--- + +## acadrust 0.4.1 — Mozilla Public License 2.0 — **MODIFIED** + +| | | +|---|---| +| Component | `acadrust` (DWG/DXF parser, Rust) | +| Version | 0.4.1 | +| License | MPL-2.0 — full text: [`public/licenses/acadrust-MPL-2.0.txt`](./public/licenses/acadrust-MPL-2.0.txt) (`/licenses/acadrust-MPL-2.0.txt`) | +| Upstream | https://github.com/hakanaktt/acadrust · https://crates.io/crates/acadrust/0.4.1 | +| Upstream commit | `f249c2f816acf36ee51cd5533716bdd443c2517e` (from the crate's `.cargo_vcs_info.json`) | +| Author | Hakan AK | +| Shipped as | compiled into `assets/acadrust_dwg_bg-*.wasm` (Executable Form) | + +**This copy is modified.** One file differs from the published crate: + +``` +src/io/dwg/dwg_stream_readers/object_reader/entities.rs (read_mesh array-count bounds) +``` + +The modification bounds `read_mesh`'s array counts by the bits remaining in the +object stream instead of the blanket 100 000-item guard, which truncated and +thereby corrupted large SubD meshes. + +### How to obtain the Source Code Form (MPL-2.0 §3.2) + +1. Get the unmodified crate source — `cargo vendor`, or + `https://crates.io/api/v1/crates/acadrust/0.4.1/download`, or the upstream + commit above. +2. Apply [`public/licenses/acadrust-0.4.1-read_mesh.patch`](./public/licenses/acadrust-0.4.1-read_mesh.patch) + (`/licenses/acadrust-0.4.1-read_mesh.patch` on the deployed site): + + ```bash + tar xf acadrust-0.4.1.crate && cd acadrust-0.4.1 + patch -p1 < acadrust-0.4.1-read_mesh.patch + ``` + +The result is the exact Source Code Form of the acadrust code compiled into the +shipped `.wasm`. Both the original and the modified file remain under MPL-2.0. + +--- + +## dwg-wasm — MIT + +The wasm-bindgen wrapper that turns acadrust output into this viewer's +`parseResult` (`hmwebviewer/rust/dwg-wasm/`). Our own code, MIT. MPL-2.0 §3.3 +permits distributing this Larger Work under different terms as long as the +MPL-covered files above keep their license — which they do. + +--- + +## Other components + +| Component | License | +|---|---| +| three.js | MIT | +| dxf-parser | MIT | +| opentype.js | MIT | +| NanumGothic (`public/fonts/`) | SIL Open Font License 1.1 | +| Viewer2D / sample glue | MIT | diff --git a/dist2/index.html b/dist2/index.html index dec9f1d..eb7a619 100644 --- a/dist2/index.html +++ b/dist2/index.html @@ -1,9 +1,9 @@ - - - - - - DWG/DXF · 모듈 조합 샘플 + + + + + + DWG/DXF · 모듈 조합 샘플 + - - -
- -
- - - - -
- - - - - -
ready
-
- -
- X - | - Y -
- - -
-
-

- 🎨 레이어 (Layers) - -

-
- - -
-
-
-
- -
-
- - -
-
-
-
- - -
-
-

📋 속성 (Properties)

-
- - - -
-
-
-
- - - - - + + +
+ +
+ + + + +
+ + + + + +
ready
+
+ +
+ X + | + Y +
+ + +
+
+

+ 🎨 레이어 (Layers) + +

+
+ + +
+
+
+
+ +
+
+ + +
+
+
+
+ + +
+
+

📋 속성 (Properties)

+
+ + + +
+
+
+
+ + + + + diff --git a/dist2/licenses/THIRD-PARTY-NOTICES.md b/dist2/licenses/THIRD-PARTY-NOTICES.md new file mode 100644 index 0000000..a3ecaef --- /dev/null +++ b/dist2/licenses/THIRD-PARTY-NOTICES.md @@ -0,0 +1,70 @@ +# Third-party notices + +This viewer bundles third-party code. The notices below apply to the source +tree **and** to the built site (`dist2/`, deployed at +`https://dwg-dxf-viewer-sample.pages.dev/`), because the build embeds the +components listed here. + +Served copies of the license texts live under +[`public/licenses/`](./public/licenses/) → `/licenses/…` on the deployed site. + +--- + +## acadrust 0.4.1 — Mozilla Public License 2.0 — **MODIFIED** + +| | | +|---|---| +| Component | `acadrust` (DWG/DXF parser, Rust) | +| Version | 0.4.1 | +| License | MPL-2.0 — full text: [`public/licenses/acadrust-MPL-2.0.txt`](./public/licenses/acadrust-MPL-2.0.txt) (`/licenses/acadrust-MPL-2.0.txt`) | +| Upstream | https://github.com/hakanaktt/acadrust · https://crates.io/crates/acadrust/0.4.1 | +| Upstream commit | `f249c2f816acf36ee51cd5533716bdd443c2517e` (from the crate's `.cargo_vcs_info.json`) | +| Author | Hakan AK | +| Shipped as | compiled into `assets/acadrust_dwg_bg-*.wasm` (Executable Form) | + +**This copy is modified.** One file differs from the published crate: + +``` +src/io/dwg/dwg_stream_readers/object_reader/entities.rs (read_mesh array-count bounds) +``` + +The modification bounds `read_mesh`'s array counts by the bits remaining in the +object stream instead of the blanket 100 000-item guard, which truncated and +thereby corrupted large SubD meshes. + +### How to obtain the Source Code Form (MPL-2.0 §3.2) + +1. Get the unmodified crate source — `cargo vendor`, or + `https://crates.io/api/v1/crates/acadrust/0.4.1/download`, or the upstream + commit above. +2. Apply [`public/licenses/acadrust-0.4.1-read_mesh.patch`](./public/licenses/acadrust-0.4.1-read_mesh.patch) + (`/licenses/acadrust-0.4.1-read_mesh.patch` on the deployed site): + + ```bash + tar xf acadrust-0.4.1.crate && cd acadrust-0.4.1 + patch -p1 < acadrust-0.4.1-read_mesh.patch + ``` + +The result is the exact Source Code Form of the acadrust code compiled into the +shipped `.wasm`. Both the original and the modified file remain under MPL-2.0. + +--- + +## dwg-wasm — MIT + +The wasm-bindgen wrapper that turns acadrust output into this viewer's +`parseResult` (`hmwebviewer/rust/dwg-wasm/`). Our own code, MIT. MPL-2.0 §3.3 +permits distributing this Larger Work under different terms as long as the +MPL-covered files above keep their license — which they do. + +--- + +## Other components + +| Component | License | +|---|---| +| three.js | MIT | +| dxf-parser | MIT | +| opentype.js | MIT | +| NanumGothic (`public/fonts/`) | SIL Open Font License 1.1 | +| Viewer2D / sample glue | MIT | diff --git a/dist2/licenses/acadrust-0.4.1-read_mesh.patch b/dist2/licenses/acadrust-0.4.1-read_mesh.patch new file mode 100644 index 0000000..59193bd --- /dev/null +++ b/dist2/licenses/acadrust-0.4.1-read_mesh.patch @@ -0,0 +1,111 @@ +--- a/src/io/dwg/dwg_stream_readers/object_reader/entities.rs ++++ b/src/io/dwg/dwg_stream_readers/object_reader/entities.rs +@@ -1682,20 +1682,49 @@ + MLineData { scale_factor, justification, start_point, normal, openclosed, lines_in_style, vertex_count, vertices, style_handle } + } + ++/// Cap an array count against the bits actually left in the object's main ++/// stream instead of the blanket [`MAX_ARRAY_COUNT`]. ++/// ++/// MESH is the one entity whose arrays legitimately run past 100 000 items: a ++/// road-surface mesh in a civil drawing carries hundreds of thousands of ++/// vertices. Clamping those to the blanket cap does not merely truncate the ++/// mesh — the reader then continues from the wrong bit offset, so the face, ++/// edge and crease lists that follow decode as garbage (observed: a 100 000 ++/// vertex clamp left a 14-face mesh with face sizes `[64, 0, 64, 23, 0, …]`). ++/// Bounding by the remaining bits keeps the corrupt-data protection — no ++/// unbounded allocation is possible — without mis-parsing a valid drawing. ++/// ++/// `min_bits_per_item` is the shortest legal encoding of one element: a ++/// BitDouble is 2 bits at minimum (the 0.0 / 1.0 forms), so a 3BD vertex is 6 ++/// and a BitLong is 2. ++fn stream_bounded_count(reader: &DwgMergedReader, raw: i32, min_bits_per_item: i64) -> i32 { ++ let raw = raw.max(0) as i64; ++ let total_bits = (reader.main().data_len() as i64).saturating_mul(8); ++ // The handle stream follows the main stream; anything past its start is not ++ // array data. handle_start() is 0 when the framing did not supply it. ++ let handle_start = reader.handle_start(); ++ let end_bits = if handle_start > 0 { handle_start.min(total_bits) } else { total_bits }; ++ let remaining = (end_bits - reader.position_in_bits()).max(0); ++ raw.min(remaining / min_bits_per_item.max(1)).min(i32::MAX as i64) as i32 ++} ++ + pub fn read_mesh(reader: &mut DwgMergedReader) -> MeshData { + let version = reader.read_bit_short(); + let blend_crease = reader.read_bit(); + let subdivision_level = reader.read_bit_long(); + +- let num_verts = safe_count(reader.read_bit_long()); ++ let raw_verts = reader.read_bit_long(); ++ let num_verts = stream_bounded_count(reader, raw_verts, 6); + let mut vertices = Vec::with_capacity(num_verts as usize); + for _ in 0..num_verts { vertices.push(reader.read_3bit_double()); } + +- let total_face_data = safe_count(reader.read_bit_long()); ++ let raw_face_data = reader.read_bit_long(); ++ let total_face_data = stream_bounded_count(reader, raw_face_data, 2); + let mut faces = Vec::new(); + let mut i = 0; + while i < total_face_data { +- let n = safe_count(reader.read_bit_long()); ++ let raw_n = reader.read_bit_long(); ++ let n = stream_bounded_count(reader, raw_n, 2); + i += 1; + let mut face = Vec::new(); + for _ in 0..n { +@@ -1705,7 +1734,8 @@ + faces.push(face); + } + +- let num_edges = safe_count(reader.read_bit_long()); ++ let raw_edges = reader.read_bit_long(); ++ let num_edges = stream_bounded_count(reader, raw_edges, 4); + let mut edges = Vec::with_capacity(num_edges as usize); + for _ in 0..num_edges { + let s = reader.read_bit_long(); +@@ -1713,7 +1743,8 @@ + edges.push((s, e)); + } + +- let num_creases = safe_count(reader.read_bit_long()); ++ let raw_creases = reader.read_bit_long(); ++ let num_creases = stream_bounded_count(reader, raw_creases, 2); + let mut crease_values = Vec::with_capacity(num_creases as usize); + for _ in 0..num_creases { crease_values.push(reader.read_bit_double()); } + +@@ -2350,14 +2381,31 @@ + pub fn read_ole2frame(reader: &mut DwgMergedReader, version: DwgVersion) -> Ole2FrameData { + let ver = reader.read_bit_short(); + let mode = if version.r2000_plus() { reader.read_bit_short() } else { 0 }; +- // OLE binary data can be very large (embedded images/documents), +- // so don't use safe_count (100 KB cap). Use a generous 10 MB cap instead. + let data_len = (reader.read_bit_long().max(0) as usize).min(10_000_000); + let data = reader.read_bytes(data_len); + let trailing_byte = if version.r2000_plus() { reader.read_byte() } else { 3 }; +- let upper_left = reader.read_3bit_double(); +- let lower_right = reader.read_3bit_double(); ++ ++ let mut upper_left = Vector3::new(0.0, 0.0, 0.0); ++ let mut lower_right = Vector3::new(0.0, 0.0, 0.0); ++ ++ // Extract 4-corner coordinates stored in the OLE binary data header starting at offset 2 ++ if data.len() >= 66 { ++ let ul_x = f64::from_le_bytes(data[2..10].try_into().unwrap()); ++ let ul_y = f64::from_le_bytes(data[10..18].try_into().unwrap()); ++ let ul_z = f64::from_le_bytes(data[18..26].try_into().unwrap()); ++ let lr_x = f64::from_le_bytes(data[50..58].try_into().unwrap()); ++ let lr_y = f64::from_le_bytes(data[58..66].try_into().unwrap()); ++ let lr_z = if data.len() >= 74 { f64::from_le_bytes(data[66..74].try_into().unwrap()) } else { 0.0 }; ++ ++ if ul_x.is_finite() && ul_y.is_finite() && lr_x.is_finite() && lr_y.is_finite() ++ && (ul_x != 0.0 || ul_y != 0.0 || lr_x != 0.0 || lr_y != 0.0) { ++ upper_left = Vector3::new(ul_x, ul_y, if ul_z.is_finite() { ul_z } else { 0.0 }); ++ lower_right = Vector3::new(lr_x, lr_y, if lr_z.is_finite() { lr_z } else { 0.0 }); ++ } ++ } ++ + let ole_type = if version.r2000_plus() { reader.read_byte() } else { 2 }; ++ + Ole2FrameData { version: ver, mode, data, trailing_byte, upper_left, lower_right, ole_type } + } + diff --git a/dist2/licenses/acadrust-MPL-2.0.txt b/dist2/licenses/acadrust-MPL-2.0.txt new file mode 100644 index 0000000..7321068 --- /dev/null +++ b/dist2/licenses/acadrust-MPL-2.0.txt @@ -0,0 +1,375 @@ +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under the name "LEGAL", and included in all Covered Software +distributed in Source Code Form. Except to the extent prohibited by +statute or regulation, such description must be sufficiently detailed +for a recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at https://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. + diff --git a/docs/license-mpl2-acadrust.md b/docs/license-mpl2-acadrust.md new file mode 100644 index 0000000..c71dd4a --- /dev/null +++ b/docs/license-mpl2-acadrust.md @@ -0,0 +1,137 @@ +# acadrust MPL-2.0 — 의무 사항과 조치 내역 + +| 항목 | 내용 | +|------|------| +| 작성 목적 | 파서(acadrust, MPL-2.0)를 담은 wasm 을 공개 배포하면서 지켜야 할 의무를 확정하고 조치 내역 기록 | +| 대상 배포물 | `https://dwg-dxf-viewer-sample.pages.dev/` (Cloudflare Pages, 공개) | +| 검토일 | 2026-08-04 | +| 상태 | **조치 완료** — 고지 파일·MPL 원문·패치 동봉, 사이트에서 링크 | + +--- + +## 0. 결론 (세 줄) + +1. **이번 lineweight 작업은 MPL 파일을 건드리지 않았다.** 수정한 `dwg-wasm/src/lib.rs` 는 + 우리 MIT 코드다. → MPL 의무가 *새로* 생기지 않았다. +2. 그러나 **이전부터** acadrust 를 한 파일 패치해서 wasm 에 컴파일해 공개 배포 중이었고, + 그 상태가 **MPL-2.0 §3.2 위반**이었다. 라이선스 원문도 고지도 소스 입수 경로도 없었다. +3. **upstream(hakanaktt/acadrust)에 PR 을 올릴 의무는 없다.** MPL 은 기여 강제가 아니다. + **배포물에 고지 + 소스 입수 경로만 넣으면 된다.** ← 이번에 그렇게 조치했다. + +--- + +## 1. 무엇이 MPL 이고 무엇이 우리 것인가 + +| 코드 | 위치 | 라이선스 | 이번 세션에서 수정? | +|------|------|----------|---------------------| +| **acadrust 0.4.1** (DWG 파서 본체) | `hmwebviewer/rust/acadrust/` | **MPL-2.0** | **아니오** | +| dwg-wasm (wasm-bindgen 래퍼 + JSON 직렬화) | `hmwebviewer/rust/dwg-wasm/src/lib.rs` | MIT (우리 코드) | 예 (lineWeight 필드 추가) | +| Viewer2D 외 프론트엔드 | `src/` | MIT | 예 | + +MPL-2.0 은 **파일 단위(file-level) 카피레프트**다. GPL 처럼 프로젝트 전체로 번지지 않는다. +MPL 파일을 고쳤으면 **그 파일만** MPL 로 유지하고 소스를 공개하면 되고, +MPL 파일을 호출·링크하는 우리 코드(§3.3 의 "Larger Work")는 우리가 원하는 라이선스로 배포할 수 있다. + +→ **`lib.rs` 에 필드 세 개 추가한 것은 MPL 전염 사유가 아니다.** + +## 2. 그럼에도 의무가 있는 이유 — 이미 한 파일을 고쳤다 + +vendored acadrust 를 crates.io 원본과 diff 하면 **정확히 한 파일**이 다르다. + +```bash +diff -rq ~/.cargo/registry/src/index.crates.io-*/acadrust-0.4.1/src \ + hmwebviewer/rust/acadrust/src +# → src/io/dwg/dwg_stream_readers/object_reader/entities.rs 만 differ +``` + +`read_mesh` 의 배열 길이를 남은 비트 수로 제한하는 패치다(대형 SubD 메쉬 손상 수정, +[`subdmesh-rendering.md`](./subdmesh-rendering.md)). **이 파일은 Modified Covered +Software** 이고, 그 소스는 MPL 하에 제공되어야 한다. + +그리고 `.wasm` 은 acadrust 를 컴파일해 담은 **Executable Form** 이다. 공개 사이트에서 +브라우저로 내려보내는 순간 MPL 상 "Distribution" 에 해당한다. + +### 적용되는 조항 + +| 조항 | 요구 | +|------|------| +| §3.1 | Source Code Form 을 배포하면 MPL 하에 배포하고 라이선스 사본을 동봉 | +| **§3.2** | **Executable Form 배포 시**: (a) 해당 Covered Software 의 Source Code Form 을 MPL 하에 제공하고, (b) **수령자에게 그 입수 방법을 알릴 것** (배포 비용 이상 청구 금지) | +| §3.3 | Larger Work(우리 앱)는 다른 라이선스로 배포 가능 — 위 (a)(b)를 지키는 한 | +| §3.4 | 라이선스·저작권 고지를 제거하지 말 것 | + +**MPL 에는 upstream 기여 의무 조항이 없다.** §3.2 는 "수령자에게 제공"이지 +"원저자에게 반영"이 아니다. + +## 3. 위반 상태였던 지점 (조치 전) + +- 배포 사이트에 MPL-2.0 **원문 없음** +- acadrust 를 쓴다는 **고지 없음** (README 표에만 한 줄, 배포물에는 미포함) +- 패치된 `entities.rs` 소스를 **얻을 방법 없음** + - `hmwebviewer` GitHub 저장소는 비공개(API 404) + - 샘플 저장소는 사내 gitea + - 즉 공개 배포 대상자가 소스에 접근할 경로가 전무 + +## 4. 조치 사항 (완료) + +### 4-1. 배포물에 동봉 + +| 파일 | 배포 URL | 내용 | +|------|----------|------| +| `public/licenses/acadrust-MPL-2.0.txt` | `/licenses/acadrust-MPL-2.0.txt` | MPL-2.0 원문 (§3.1·§3.4) | +| `public/licenses/acadrust-0.4.1-read_mesh.patch` | `/licenses/acadrust-0.4.1-read_mesh.patch` | 우리 수정분 diff (§3.2(a)) | +| `public/licenses/THIRD-PARTY-NOTICES.md` | `/licenses/THIRD-PARTY-NOTICES.md` | 컴포넌트·버전·업스트림·수정 여부·복원 절차 (§3.2(b)) | + +저장소 루트에도 같은 내용의 [`../THIRD-PARTY-NOTICES.md`](../THIRD-PARTY-NOTICES.md) 를 둔다. + +### 4-2. 사이트에서 링크 + +`index.html` 우측 "Module recipe" 패널 하단에 고지 링크 추가. +§3.2(b) 의 "reasonable manner" 요건은 **수령자가 실제로 찾을 수 있는 위치**를 요구한다. + +### 4-3. 소스 복원 절차 명시 + +원본 크레이트 + 패치 조합이면 컴파일된 소스를 바이트 단위로 재현할 수 있다. + +```bash +curl -O https://crates.io/api/v1/crates/acadrust/0.4.1/download +tar xf download && cd acadrust-0.4.1 +patch -p1 < acadrust-0.4.1-read_mesh.patch +``` + +업스트림 커밋 `f249c2f816acf36ee51cd5533716bdd443c2517e` 도 고지에 적어 뒀다 +(크레이트의 `.cargo_vcs_info.json` 값). + +## 5. 질문에 대한 답 + +> **"해당 레포(upstream)에 올려야 하나, 배포시 문서만 추가하면 되나?"** + +**문서(고지) + 소스 입수 경로만 배포물에 넣으면 된다. upstream PR 은 의무가 아니다.** + +| 선택지 | MPL 상 필요? | 판단 | +|--------|--------------|------| +| 배포물에 MPL 원문 + 고지 + 패치 동봉 | **필수** | ✅ 이번에 조치 | +| upstream `hakanaktt/acadrust` 에 PR | 아니오 | 선택 — read_mesh 수정은 일반 버그픽스라 올리면 유지보수 부담이 준다 (권장, 의무 아님) | +| `hmwebviewer` 저장소 공개 전환 | 아니오 | 불필요 — 패치 동봉으로 §3.2 충족 | +| 패치된 acadrust 전체 소스를 이 저장소에 vendoring | 아니오 | 더 엄격한 대안. 189 파일이 샘플 저장소에 들어와 무거워짐. 원본+패치 방식은 배포판(distro) 관행과 동일하고 §3.2 를 충족 | + +> **"lineweight 작업으로 라이선스 의무가 생겼나?"** + +**아니오.** 이번에 고친 `dwg-wasm/src/lib.rs` 는 MIT 인 우리 파일이고, MPL 파일은 +건드리지 않았다(위 §2 diff 로 확인). 의무는 **이전 read_mesh 패치 + wasm 공개 배포**에서 +이미 발생해 있었고, 이번에 뒤늦게 정리한 것이다. + +## 6. 앞으로 지킬 것 (체크리스트) + +- [ ] `rust/acadrust/` 아래 파일을 고치면 → 패치 파일을 다시 뽑아 `public/licenses/` 갱신 +- [ ] acadrust 버전을 올리면 → 고지의 버전·커밋·패치를 함께 갱신 +- [ ] 새 서드파티를 번들하면 → `THIRD-PARTY-NOTICES.md` 에 행 추가 +- [ ] MPL 파일에서 라이선스 헤더 주석을 지우지 말 것 (§3.4) +- [ ] 배포 전 `/licenses/` 3개 파일이 실제로 서빙되는지 확인 + +## 7. 참고 + +- MPL-2.0 원문: [`../public/licenses/acadrust-MPL-2.0.txt`](../public/licenses/acadrust-MPL-2.0.txt) +- FAQ: https://www.mozilla.org/MPL/2.0/FAQ/ (Q: file-level copyleft, Q: 배포 의무 범위) +- 수정 경위: [`subdmesh-rendering.md`](./subdmesh-rendering.md) +- 이번 파서 변경(MIT 영역): [`lineweight-rendering.md`](./lineweight-rendering.md) §4-1 diff --git a/index.html b/index.html index bc0fe54..461ae4f 100644 --- a/index.html +++ b/index.html @@ -275,6 +275,12 @@ 코드: src/main.ts · 지도: docs/modules-dwg-dxf.html

+ +

+ 오픈소스 고지: THIRD-PARTY-NOTICES + (acadrust · MPL-2.0 · local patch) +

diff --git a/public/licenses/THIRD-PARTY-NOTICES.md b/public/licenses/THIRD-PARTY-NOTICES.md new file mode 100644 index 0000000..a3ecaef --- /dev/null +++ b/public/licenses/THIRD-PARTY-NOTICES.md @@ -0,0 +1,70 @@ +# Third-party notices + +This viewer bundles third-party code. The notices below apply to the source +tree **and** to the built site (`dist2/`, deployed at +`https://dwg-dxf-viewer-sample.pages.dev/`), because the build embeds the +components listed here. + +Served copies of the license texts live under +[`public/licenses/`](./public/licenses/) → `/licenses/…` on the deployed site. + +--- + +## acadrust 0.4.1 — Mozilla Public License 2.0 — **MODIFIED** + +| | | +|---|---| +| Component | `acadrust` (DWG/DXF parser, Rust) | +| Version | 0.4.1 | +| License | MPL-2.0 — full text: [`public/licenses/acadrust-MPL-2.0.txt`](./public/licenses/acadrust-MPL-2.0.txt) (`/licenses/acadrust-MPL-2.0.txt`) | +| Upstream | https://github.com/hakanaktt/acadrust · https://crates.io/crates/acadrust/0.4.1 | +| Upstream commit | `f249c2f816acf36ee51cd5533716bdd443c2517e` (from the crate's `.cargo_vcs_info.json`) | +| Author | Hakan AK | +| Shipped as | compiled into `assets/acadrust_dwg_bg-*.wasm` (Executable Form) | + +**This copy is modified.** One file differs from the published crate: + +``` +src/io/dwg/dwg_stream_readers/object_reader/entities.rs (read_mesh array-count bounds) +``` + +The modification bounds `read_mesh`'s array counts by the bits remaining in the +object stream instead of the blanket 100 000-item guard, which truncated and +thereby corrupted large SubD meshes. + +### How to obtain the Source Code Form (MPL-2.0 §3.2) + +1. Get the unmodified crate source — `cargo vendor`, or + `https://crates.io/api/v1/crates/acadrust/0.4.1/download`, or the upstream + commit above. +2. Apply [`public/licenses/acadrust-0.4.1-read_mesh.patch`](./public/licenses/acadrust-0.4.1-read_mesh.patch) + (`/licenses/acadrust-0.4.1-read_mesh.patch` on the deployed site): + + ```bash + tar xf acadrust-0.4.1.crate && cd acadrust-0.4.1 + patch -p1 < acadrust-0.4.1-read_mesh.patch + ``` + +The result is the exact Source Code Form of the acadrust code compiled into the +shipped `.wasm`. Both the original and the modified file remain under MPL-2.0. + +--- + +## dwg-wasm — MIT + +The wasm-bindgen wrapper that turns acadrust output into this viewer's +`parseResult` (`hmwebviewer/rust/dwg-wasm/`). Our own code, MIT. MPL-2.0 §3.3 +permits distributing this Larger Work under different terms as long as the +MPL-covered files above keep their license — which they do. + +--- + +## Other components + +| Component | License | +|---|---| +| three.js | MIT | +| dxf-parser | MIT | +| opentype.js | MIT | +| NanumGothic (`public/fonts/`) | SIL Open Font License 1.1 | +| Viewer2D / sample glue | MIT | diff --git a/public/licenses/acadrust-0.4.1-read_mesh.patch b/public/licenses/acadrust-0.4.1-read_mesh.patch new file mode 100644 index 0000000..59193bd --- /dev/null +++ b/public/licenses/acadrust-0.4.1-read_mesh.patch @@ -0,0 +1,111 @@ +--- a/src/io/dwg/dwg_stream_readers/object_reader/entities.rs ++++ b/src/io/dwg/dwg_stream_readers/object_reader/entities.rs +@@ -1682,20 +1682,49 @@ + MLineData { scale_factor, justification, start_point, normal, openclosed, lines_in_style, vertex_count, vertices, style_handle } + } + ++/// Cap an array count against the bits actually left in the object's main ++/// stream instead of the blanket [`MAX_ARRAY_COUNT`]. ++/// ++/// MESH is the one entity whose arrays legitimately run past 100 000 items: a ++/// road-surface mesh in a civil drawing carries hundreds of thousands of ++/// vertices. Clamping those to the blanket cap does not merely truncate the ++/// mesh — the reader then continues from the wrong bit offset, so the face, ++/// edge and crease lists that follow decode as garbage (observed: a 100 000 ++/// vertex clamp left a 14-face mesh with face sizes `[64, 0, 64, 23, 0, …]`). ++/// Bounding by the remaining bits keeps the corrupt-data protection — no ++/// unbounded allocation is possible — without mis-parsing a valid drawing. ++/// ++/// `min_bits_per_item` is the shortest legal encoding of one element: a ++/// BitDouble is 2 bits at minimum (the 0.0 / 1.0 forms), so a 3BD vertex is 6 ++/// and a BitLong is 2. ++fn stream_bounded_count(reader: &DwgMergedReader, raw: i32, min_bits_per_item: i64) -> i32 { ++ let raw = raw.max(0) as i64; ++ let total_bits = (reader.main().data_len() as i64).saturating_mul(8); ++ // The handle stream follows the main stream; anything past its start is not ++ // array data. handle_start() is 0 when the framing did not supply it. ++ let handle_start = reader.handle_start(); ++ let end_bits = if handle_start > 0 { handle_start.min(total_bits) } else { total_bits }; ++ let remaining = (end_bits - reader.position_in_bits()).max(0); ++ raw.min(remaining / min_bits_per_item.max(1)).min(i32::MAX as i64) as i32 ++} ++ + pub fn read_mesh(reader: &mut DwgMergedReader) -> MeshData { + let version = reader.read_bit_short(); + let blend_crease = reader.read_bit(); + let subdivision_level = reader.read_bit_long(); + +- let num_verts = safe_count(reader.read_bit_long()); ++ let raw_verts = reader.read_bit_long(); ++ let num_verts = stream_bounded_count(reader, raw_verts, 6); + let mut vertices = Vec::with_capacity(num_verts as usize); + for _ in 0..num_verts { vertices.push(reader.read_3bit_double()); } + +- let total_face_data = safe_count(reader.read_bit_long()); ++ let raw_face_data = reader.read_bit_long(); ++ let total_face_data = stream_bounded_count(reader, raw_face_data, 2); + let mut faces = Vec::new(); + let mut i = 0; + while i < total_face_data { +- let n = safe_count(reader.read_bit_long()); ++ let raw_n = reader.read_bit_long(); ++ let n = stream_bounded_count(reader, raw_n, 2); + i += 1; + let mut face = Vec::new(); + for _ in 0..n { +@@ -1705,7 +1734,8 @@ + faces.push(face); + } + +- let num_edges = safe_count(reader.read_bit_long()); ++ let raw_edges = reader.read_bit_long(); ++ let num_edges = stream_bounded_count(reader, raw_edges, 4); + let mut edges = Vec::with_capacity(num_edges as usize); + for _ in 0..num_edges { + let s = reader.read_bit_long(); +@@ -1713,7 +1743,8 @@ + edges.push((s, e)); + } + +- let num_creases = safe_count(reader.read_bit_long()); ++ let raw_creases = reader.read_bit_long(); ++ let num_creases = stream_bounded_count(reader, raw_creases, 2); + let mut crease_values = Vec::with_capacity(num_creases as usize); + for _ in 0..num_creases { crease_values.push(reader.read_bit_double()); } + +@@ -2350,14 +2381,31 @@ + pub fn read_ole2frame(reader: &mut DwgMergedReader, version: DwgVersion) -> Ole2FrameData { + let ver = reader.read_bit_short(); + let mode = if version.r2000_plus() { reader.read_bit_short() } else { 0 }; +- // OLE binary data can be very large (embedded images/documents), +- // so don't use safe_count (100 KB cap). Use a generous 10 MB cap instead. + let data_len = (reader.read_bit_long().max(0) as usize).min(10_000_000); + let data = reader.read_bytes(data_len); + let trailing_byte = if version.r2000_plus() { reader.read_byte() } else { 3 }; +- let upper_left = reader.read_3bit_double(); +- let lower_right = reader.read_3bit_double(); ++ ++ let mut upper_left = Vector3::new(0.0, 0.0, 0.0); ++ let mut lower_right = Vector3::new(0.0, 0.0, 0.0); ++ ++ // Extract 4-corner coordinates stored in the OLE binary data header starting at offset 2 ++ if data.len() >= 66 { ++ let ul_x = f64::from_le_bytes(data[2..10].try_into().unwrap()); ++ let ul_y = f64::from_le_bytes(data[10..18].try_into().unwrap()); ++ let ul_z = f64::from_le_bytes(data[18..26].try_into().unwrap()); ++ let lr_x = f64::from_le_bytes(data[50..58].try_into().unwrap()); ++ let lr_y = f64::from_le_bytes(data[58..66].try_into().unwrap()); ++ let lr_z = if data.len() >= 74 { f64::from_le_bytes(data[66..74].try_into().unwrap()) } else { 0.0 }; ++ ++ if ul_x.is_finite() && ul_y.is_finite() && lr_x.is_finite() && lr_y.is_finite() ++ && (ul_x != 0.0 || ul_y != 0.0 || lr_x != 0.0 || lr_y != 0.0) { ++ upper_left = Vector3::new(ul_x, ul_y, if ul_z.is_finite() { ul_z } else { 0.0 }); ++ lower_right = Vector3::new(lr_x, lr_y, if lr_z.is_finite() { lr_z } else { 0.0 }); ++ } ++ } ++ + let ole_type = if version.r2000_plus() { reader.read_byte() } else { 2 }; ++ + Ole2FrameData { version: ver, mode, data, trailing_byte, upper_left, lower_right, ole_type } + } + diff --git a/public/licenses/acadrust-MPL-2.0.txt b/public/licenses/acadrust-MPL-2.0.txt new file mode 100644 index 0000000..7321068 --- /dev/null +++ b/public/licenses/acadrust-MPL-2.0.txt @@ -0,0 +1,375 @@ +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under the name "LEGAL", and included in all Covered Software +distributed in Source Code Form. Except to the extent prohibited by +statute or regulation, such description must be sufficiently detailed +for a recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at https://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. +