Repository navigation
anim_glb: reject non-finite binary float data - #4927
XFlawless1 wants to merge 1 commit into
Conversation
whattheflop
left a comment
There was a problem hiding this comment.
Independent CPU positive-path verification, AI-assisted, with uv CPython 3.12.13. Main 3faac557 and the clean merged tree 54a8addb168beb0beb3be65b0acf6d530d7c2b9d emitted byte-identical GLBs from the stock synthetic exports. A second run through the same exporter with eight hand-built decoded tracks also produced byte-identical GLBs. It covered translation, rotation, scale, and mover channels.
Independent accessor decoding confirmed all eight channels used LINEAR interpolation, and each six-key time array covered 0–2.3 seconds in strictly increasing order. The checked transforms matched the supplied values within 1e−6. This verifies that the finite-value check preserves valid export bytes. No GPU or game inputs.
jeremygold02
left a comment
There was a problem hiding this comment.
Verified the playback and overwrite behavior on Windows. On main at 3faac557, a non-finite second translation key made a skinned vertex's entire world position NaN even at time zero, where the first stored key was finite. With #4927 at c8029171 merged onto that same base (tree 54a8addb), each rejected export preserved the previous playable GLB and its JSON report byte for byte.
| Second key's X component | CLI on main | CLI on the merged PR | three.js after the PR run |
|---|---|---|---|
| NaN, +∞, or −∞ | Exit 0 and replace both files. The loader accepts each GLB, then the skinned vertex reads (NaN, NaN, NaN) at the start, midpoint and end. |
Exit 2, one diagnostic, both files preserved | The previous clip's vertex X reads 0, 1 and 2 m. |
Finite source values decoding to 3e38 × 2 |
Exit 1 with an OverflowError traceback |
Exit 2, one diagnostic, both files preserved | Same 0, 1 and 2 m playback. |
Reproduction. I used the three-joint skeleton and four-vertex part from tests/test_anim_glb.py, with all vertices fully weighted to SKEL_A. I first exported a valid two-track clip and report. I then reran the same CLI against those output paths with one two-key root translation track. The type-3 X channel was [0, value], with Y constant at 0 and Z constant at 1. For overflow I used a type-4 X channel with quantum 3e38 and integer samples [0, 2]. The old clip's extra unweighted bone track distinguished both its GLB and its report from a replacement. I reloaded each result with three.js r160 GLTFLoader, played it with AnimationMixer, and read vertex 0 with SkinnedMesh.getVertexPosition() in world space. As a finite control, the largest float32 passed both revisions and sampled to approximately 1.7014117e38 at the midpoint.
The animated exporter, animation decoder, atomic GLB writer and text line-ending suites reported 88 passed and 29 subtests passed on the merged PR. Windows skipped one POSIX permission-bit test. Windows 11, Python 3.12.10, Node 24.18.0, Intel Core Ultra 7 265K. Playback used the CPU. Both installed GPUs were idle (NVIDIA GeForce RTX 5070, driver 32.0.16.2101, and Intel Graphics, driver 32.0.101.9150). All fixtures were synthetic.
AI-assisted by GPT-6.2 Astra.
|
Tested c802917 on Arch Linux (in a VM), CPython 3.14: pass.
|
|
Verified merged with main 3faac55: the full anim_glb suite passes 37/37 under python -I, including the new NaN/inf/overflow rejections, the untouched-previous-output guarantee, and exact float32 bit preservation for signed zeros and subnormals. Main's existing isfinite checks cover bind matrices and clip windows but never the packed float buffers, so the gap is real and this closes it. stdlib-only, no compliance findings, CI pending. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run). |
|
Tested
|
shayderrr
left a comment
There was a problem hiding this comment.
Review
Reviewed change in PR #4927: anim_glb: reject non-finite binary float data.
Scope: tests/test_anim_glb.py, tools/anim_glb.py
Diff: +76 / -1 across 2 file(s).
The change stays inside the stated scope and the touched files line up with the description. No unrelated production paths are pulled in, and the stated behavior is directly exercised by the diff. I'm approving this one.
Reviewed by shayderrr via automated batch review.
|
Thanks @XFlawless1 - I went through anim_glb: reject non-finite binary float data and the diff around |
Claimed in the coordination issue.
What and why
Animated GLB exports could write NaN and infinity directly into binary accessors. JSON's
allow_nan=Falsedoes not check those buffers, and the glTF animation accessor rules prohibit non-finite keyframe data. Finite values too large for float32 also escaped as an uncaughtOverflowError.The shared float packer now refuses non-finite values and converts float32 overflow into
ExportError. The CLI uses its existing exit-2 diagnostic and stops before replacing the GLB or its report. Valid encodings, including signed zero, subnormals and the largest finite float32, remain byte-exact.Tested
The initial regression cases failed on unchanged main (17 failures, 5 errors).
test_loop_ballot_barrier.py(plus 4 skips and 1 expected failure). Running that complete 15-test module on pristine main3faac557reproduces the same failures and errors, as covered by existing PR #4808.python3 -m compileall -q make_game.py tools tests, isolatedmake_game.py --help, andgit diff --checkpassed.Tested on Linux x86_64, Python 3.14.4, against upstream main
3faac557. CPU only; no GPU or driver used. Windows was not tested locally. All archives, animation tracks and geometry are synthetic.The published branch starts at fork main
16282101; its animated-GLB suite also passes (22 tests). Its merge onto3faac557produces tree54a8addb168beb0beb3be65b0acf6d530d7c2b9d, exactly the tested tree (git merge-tree --write-tree). The PR changes only the exporter and its tests.AI-assisted: yes (Codex).
Checklist
docs/design.md, with how it was confirmed. (No translator changes.)