mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:50:52 +01:00
[PR #1520] ped_assemble: harden output guards, atomic JSON reports, and input/skeleton validation (PED-ASSEMBLE-VALIDATION-AND-IO-HARDENING) #1549
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1549
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1520
Author: @IlyassRS3
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/ped-assemble-hardening📝 Commits (1)
6366c36ped_assemble: harden output guards, atomic JSON reports, and input/skeleton validation (PED-ASSEMBLE-VALIDATION-AND-IO-HARDENING)📊 Changes
2 files changed (+969 additions, -103 deletions)
View changed files
📝
tests/test_ped_assemble.py(+387 -0)📝
tools/ped_assemble.py(+582 -103)📄 Description
Summary
Hardens
tools/ped_assemble.pyacross output overwrite/collision safety, atomic JSON report publishing, binary glTF container bounds, skeleton hierarchy/IBM integrity, tolerance validation, and malformed JSON/manifest error handling:_check_output_paths): checks-o/--outand--jsonacrossassemble,cull-overlap, andinspect-seamsagainst existing directories, each other, direct inputs, and transitively loaded manifest parts / external PNG texture files usingreport_paths.same_report_path._write_json_report,build_assembled_glb): stages JSON reports in a sibling temp file withnewline="\n",allow_nan=False,file_mode.published_mode, andreplace_retry.replace(preserving pre-existing files on error and cleaning up temp files), and enforcesallow_nan=Falseinbuild_assembled_glb.read_glb_parts): rejectstotal_len < 20, chunk headers whosepos + chunk_len > total_len, unconsumed trailing bytes withintotal_len, and out-of-range triangle vertex indices._validate_skeleton,_pack_f32_vec,_pack_u16_vec4,build_assembled_glb): rejects self-parent and multi-joint parent cycles, out-of-range orboolparents, unsupportedskeleton.coord_space, non-16-floatinverse_bind_matrixentries ony-upskeletons, non-finite values, and float32-overflowing attributes/IBMs withPedAssembleErrorinstead of silent corruption or rawOverflowError.standing_offset, non-negative finite tolerances (--waist-tol,--nipple-tol,--genital-tol,--plane-tol,--vertex-tol,--weld-tol,--tol,--overlap-tol), andnormal_cos_minin[-1, 1]in bothbuild_parser()and core API functions.load_parts_from_path,_read_png_spec,_parse_material_dict,_part_from_dict,_skeleton_from_dict,main): detects cyclic JSON manifests, validatesbase64:payloads and material fields (base_color_factor,alpha_mode, finite factors), validates JSON part/triangle bounds, and catchesOSError/glb_writer.GlbErrorinmain()for clean exit-2ERROR:reporting.Coordination
PED-ASSEMBLE-VALIDATION-AND-IO-HARDENING(https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7151612040)Testing
python3 -I tests/test_ped_assemble.py -v— 22/22 OK (including 6 new regression tests inValidationAndIoHardeningTests)python3 -I tests/test_ped_assemble_malformed_glb.py— 8/8 OKpython3 -I tests/test_ped_assemble_sparse_glb.py— 7/7 OKpython3 -I tests/test_ped_extra_uvs.py— 7/7 OKpython3 -I tests/test_ped_glb_material_defaults.py— 6/6 OKpython3 -I tests/test_ped_json_textures.py— 4/4 OKpython3 -I tests/test_ped_snorm.py— 5/5 OKpython3 -I tests/test_json_bom_inputs.py— 10/10 OKpython3 -I tests/test_text_write_line_endings.py— 3/3 OKpython3 -I scripts/check_no_game_data.py tools/ped_assemble.py tests/test_ped_assemble.py— cleanpython3 -m compileall -q tools/ped_assemble.py tests/test_ped_assemble.py— cleanmain:tools/ped_assemble.py: 6/6 tests inValidationAndIoHardeningTestsfail (FAILED (failures=5, errors=1)).Checklist
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.