rust-map-parser 0.1.1__tar.gz → 0.1.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {rust_map_parser-0.1.1/src/rust_map_parser.egg-info → rust_map_parser-0.1.3}/PKG-INFO +2 -2
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/pyproject.toml +5 -2
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3/src/rust_map_parser.egg-info}/PKG-INFO +2 -2
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rust_map_parser.egg-info/SOURCES.txt +1 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rust_map_parser.egg-info/requires.txt +1 -1
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/__init__.py +1 -1
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/parser.py +17 -1
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/tunnels.py +5 -1
- rust_map_parser-0.1.3/tests/test_parser_security.py +32 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/LICENSE +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/MANIFEST.in +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/README.md +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/docs/export-config.md +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/docs/export-result.md +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/docs/images/heatmap-ores.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/docs/images/map-render.jpg +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/docs/images/no-build-zones.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/docs/images/splat-composite.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/docs/images/tunnels-layer.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/example.py +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/refresh_all_data.py +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/setup.cfg +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rust_map_parser.egg-info/dependency_links.txt +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rust_map_parser.egg-info/top_level.txt +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/config.py +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/__init__.py +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/monument_metadata.json +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/no_build_zones.json +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/prefab_manifest.json +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/spawn_rules.json +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/__init__.py +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_000__curve-nw-0.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_001__curve-nw-1.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_002__intersection-bb1-n.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_003__intersection-bb4-n.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_004__intersection-b5-n.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_005__intersection-b3-n.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_006__intersection-b2-n.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_007__intersection-bb2-n.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_008__intersection-b6-n.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_009__intersection-bb3-n.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_010__intersection-b4-n.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_011__intersection-bb6-n.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_012__intersection-n.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_013__intersection-b1-n.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_014__intersection-bb5-n.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_015__station-sn-0.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_016__straight-sn-3.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_017__straight-sn-2.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_018__station-sn-1.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_019__straight-sn-0.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_020__straight-sn-1.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_021__station-sn-3.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_022__straight-sn-4.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_023__station-sn-2.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_024__straight-sn-5.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_025__curve-ne-1.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_026__curve-ne-0.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_027__intersection.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_028__intersection-bb2-s.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_029__intersection-b2-s.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_030__intersection-b6-s.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_031__intersection-bb5-s.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_032__intersection-bb1-s.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_033__intersection-s.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_034__intersection-b1-s.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_035__intersection-bb6-s.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_036__intersection-b5-s.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_037__intersection-bb4-s.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_038__intersection-b3-s.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_039__intersection-bb3-s.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_040__intersection-b4-s.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_041__straight-we-3.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_042__station-we-1.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_043__straight-we-5.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_044__straight-we-4.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_045__station-we-2.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_046__station-we-3.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_047__station-we-0.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_048__straight-we-2.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_049__straight-we-1.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_050__straight-we-0.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_051__curve-se-0.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_052__curve-se-1.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_053__intersection-bb3-w.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_054__intersection-w.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_055__intersection-bb5-w.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_056__intersection-b5-w.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_057__intersection-b1-w.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_058__intersection-bb1-w.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_059__intersection-bb4-w.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_060__intersection-b4-w.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_061__intersection-b6-w.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_062__intersection-bb2-w.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_063__intersection-b3-w.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_064__intersection-b2-w.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_065__intersection-bb6-w.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_066__curve-sw-0.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_067__curve-sw-1.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_068__intersection-bb3-e.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_069__intersection-bb6-e.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_070__intersection-b4-e.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_071__intersection-b6-e.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_072__intersection-b5-e.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_073__intersection-b1-e.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_074__intersection-b3-e.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_075__intersection-bb2-e.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_076__intersection-e.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_077__intersection-bb1-e.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_078__intersection-bb4-e.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_079__intersection-b2-e.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/template_080__intersection-bb5-e.png +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/data/tunnel_tiles/tiles.json +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/exporter.py +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/layers.py +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/monument_assets.py +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/monuments.py +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/no_build.py +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/no_build_assets.py +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/png.py +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/populations.py +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/prefabs.py +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/renderer.py +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/resources.py +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/tunnel_assets.py +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rustmap/validation.py +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/tests/test_exporter.py +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/tests/test_map_tiles.py +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/tests/test_monuments.py +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/tests/test_no_build.py +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/tests/test_png_metadata.py +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/tests/test_populations.py +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/tests/test_renderer_water.py +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/tests/test_tunnels.py +0 -0
- {rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/tests/test_validation.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rust-map-parser
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.3
|
|
4
4
|
Summary: Standalone Python parser, heatmap generator, and renderer for Facepunch Rust map files
|
|
5
5
|
Author: rust-map-parser contributors
|
|
6
6
|
License-Expression: MIT
|
|
@@ -18,7 +18,7 @@ Description-Content-Type: text/markdown
|
|
|
18
18
|
License-File: LICENSE
|
|
19
19
|
Requires-Dist: lz4==4.4.4
|
|
20
20
|
Requires-Dist: numpy<3,>=2.0
|
|
21
|
-
Requires-Dist: Pillow<13,>=
|
|
21
|
+
Requires-Dist: Pillow<13,>=12.2
|
|
22
22
|
Requires-Dist: numba<1,>=0.61
|
|
23
23
|
Provides-Extra: assets
|
|
24
24
|
Requires-Dist: UnityPy==1.24.2; extra == "assets"
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "rust-map-parser"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.3"
|
|
8
8
|
description = "Standalone Python parser, heatmap generator, and renderer for Facepunch Rust map files"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -21,7 +21,7 @@ classifiers = [
|
|
|
21
21
|
dependencies = [
|
|
22
22
|
"lz4==4.4.4",
|
|
23
23
|
"numpy>=2.0,<3",
|
|
24
|
-
"Pillow>=
|
|
24
|
+
"Pillow>=12.2,<13",
|
|
25
25
|
"numba>=0.61,<1",
|
|
26
26
|
]
|
|
27
27
|
|
|
@@ -43,3 +43,6 @@ where = ["src"]
|
|
|
43
43
|
[tool.setuptools.package-data]
|
|
44
44
|
"rustmap.data" = ["*.json"]
|
|
45
45
|
"rustmap.data.tunnel_tiles" = ["*.json", "*.png"]
|
|
46
|
+
|
|
47
|
+
[tool.pytest.ini_options]
|
|
48
|
+
testpaths = ["tests"]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rust-map-parser
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.3
|
|
4
4
|
Summary: Standalone Python parser, heatmap generator, and renderer for Facepunch Rust map files
|
|
5
5
|
Author: rust-map-parser contributors
|
|
6
6
|
License-Expression: MIT
|
|
@@ -18,7 +18,7 @@ Description-Content-Type: text/markdown
|
|
|
18
18
|
License-File: LICENSE
|
|
19
19
|
Requires-Dist: lz4==4.4.4
|
|
20
20
|
Requires-Dist: numpy<3,>=2.0
|
|
21
|
-
Requires-Dist: Pillow<13,>=
|
|
21
|
+
Requires-Dist: Pillow<13,>=12.2
|
|
22
22
|
Requires-Dist: numba<1,>=0.61
|
|
23
23
|
Provides-Extra: assets
|
|
24
24
|
Requires-Dist: UnityPy==1.24.2; extra == "assets"
|
|
@@ -16,6 +16,15 @@ from typing import Iterator
|
|
|
16
16
|
import lz4.block
|
|
17
17
|
|
|
18
18
|
|
|
19
|
+
# Rust currently writes one-megabyte legacy LZ4 chunks and normal procedural
|
|
20
|
+
# maps decode to well below 1 GiB. Bound attacker-controlled length fields
|
|
21
|
+
# before allocating so a corrupt/untrusted map cannot cause unbounded memory or
|
|
22
|
+
# CPU consumption.
|
|
23
|
+
MAX_LZ4_CHUNK_BYTES = 16 * 1024 * 1024
|
|
24
|
+
MAX_DECOMPRESSED_MAP_BYTES = 1024 * 1024 * 1024
|
|
25
|
+
MAX_LZ4_CHUNKS = 4096
|
|
26
|
+
|
|
27
|
+
|
|
19
28
|
class RustMapError(ValueError):
|
|
20
29
|
"""Raised when a map is truncated, corrupt, or unsupported."""
|
|
21
30
|
|
|
@@ -237,12 +246,20 @@ def _read_stream_varint(stream, *, allow_eof: bool = False) -> int | None:
|
|
|
237
246
|
|
|
238
247
|
def _decompress_legacy_lz4(stream) -> bytearray:
|
|
239
248
|
output = bytearray()
|
|
249
|
+
chunk_count = 0
|
|
240
250
|
while True:
|
|
241
251
|
flags = _read_stream_varint(stream, allow_eof=True)
|
|
242
252
|
if flags is None:
|
|
243
253
|
break
|
|
254
|
+
chunk_count += 1
|
|
255
|
+
if chunk_count > MAX_LZ4_CHUNKS:
|
|
256
|
+
raise RustMapError("Legacy LZ4 stream contains too many chunks")
|
|
244
257
|
original_length = _read_stream_varint(stream)
|
|
245
258
|
assert original_length is not None
|
|
259
|
+
if original_length > MAX_LZ4_CHUNK_BYTES:
|
|
260
|
+
raise RustMapError("Legacy LZ4 chunk exceeds the safety limit")
|
|
261
|
+
if len(output) + original_length > MAX_DECOMPRESSED_MAP_BYTES:
|
|
262
|
+
raise RustMapError("Decompressed map exceeds the safety limit")
|
|
246
263
|
is_compressed = bool(flags & 1)
|
|
247
264
|
if flags >> 2:
|
|
248
265
|
raise RustMapError("Multi-pass legacy LZ4 chunks are unsupported")
|
|
@@ -294,4 +311,3 @@ def load_map(path: str | Path) -> RustMap:
|
|
|
294
311
|
elif number == 4:
|
|
295
312
|
paths.append(_path(value))
|
|
296
313
|
return RustMap(version, timestamp, size, layers, prefabs, paths, protobuf_buffer)
|
|
297
|
-
|
|
@@ -107,7 +107,11 @@ def render_tunnel_map(world, manifest: PrefabManifest, geometry_cache: str | Pat
|
|
|
107
107
|
template_prepare_seconds = template_png_load_seconds = paste_seconds = fallback_seconds = 0.0
|
|
108
108
|
cache_load_started = time.perf_counter()
|
|
109
109
|
|
|
110
|
-
arrays_context =
|
|
110
|
+
arrays_context = (
|
|
111
|
+
np.load(geometry_path, allow_pickle=False)
|
|
112
|
+
if geometry_path is not None and geometry_path.is_file()
|
|
113
|
+
else nullcontext(None)
|
|
114
|
+
)
|
|
111
115
|
with arrays_context as arrays:
|
|
112
116
|
cache_load_seconds = time.perf_counter() - cache_load_started
|
|
113
117
|
templates = {item["prefab_path"]: item for item in cache_metadata["templates"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
from io import BytesIO
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
|
|
5
|
+
from rustmap.parser import (
|
|
6
|
+
MAX_LZ4_CHUNK_BYTES,
|
|
7
|
+
MAX_LZ4_CHUNKS,
|
|
8
|
+
RustMapError,
|
|
9
|
+
_decompress_legacy_lz4,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _varint(value: int) -> bytes:
|
|
14
|
+
encoded = bytearray()
|
|
15
|
+
while value >= 0x80:
|
|
16
|
+
encoded.append((value & 0x7F) | 0x80)
|
|
17
|
+
value >>= 7
|
|
18
|
+
encoded.append(value)
|
|
19
|
+
return bytes(encoded)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def test_legacy_lz4_rejects_attacker_controlled_oversized_chunk() -> None:
|
|
23
|
+
stream = BytesIO(_varint(0) + _varint(MAX_LZ4_CHUNK_BYTES + 1))
|
|
24
|
+
with pytest.raises(RustMapError, match="chunk exceeds"):
|
|
25
|
+
_decompress_legacy_lz4(stream)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def test_legacy_lz4_rejects_pathological_chunk_count() -> None:
|
|
29
|
+
zero_length_chunk = _varint(0) + _varint(0)
|
|
30
|
+
stream = BytesIO(zero_length_chunk * (MAX_LZ4_CHUNKS + 1))
|
|
31
|
+
with pytest.raises(RustMapError, match="too many chunks"):
|
|
32
|
+
_decompress_legacy_lz4(stream)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rust_map_parser-0.1.1 → rust_map_parser-0.1.3}/src/rust_map_parser.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|