Repository navigation
tex_headers: reject bool and non-int inputs in decode_etpf_chunk_pages and compact_surface_layout - #8774
tex_headers: reject bool and non-int inputs in decode_etpf_chunk_pages and compact_surface_layout#8774cristianvaz wants to merge 1 commit into
Conversation
…s and compact_surface_layout
sds-228
left a comment
There was a problem hiding this comment.
Focused suite passes 2/2 at this head; both new validation tests fail against the pre-change source. Boolean and non-integer inputs are rejected without changing valid decoding.
AI-assisted (OpenCode).
|
Tested 3db4f37 on Windows 11 (CPU only, no GPU needed): pass Windows 11 Pro, Python 3.14.7, no GPU or game files involved; pytest/numpy/Pillow pinned from
AI-assisted (Claude Code, Claude Opus 5.5). |
|
Tested
AI-assisted (Claude Code). |
Claimed in #8683: #8683 (comment)
Summary
Rejects
bool(which satisfiesisinstance(..., int)in Python) and non-integer parameters in two layout/chunk helpers intools/tex_headers.py:decode_etpf_chunk_pages(meta, extra)(tools/tex_headers.py:355-357): ReturnsNonewhenmetaorextrais aboolinstead of treatingTrue/Falseas1/0.compact_surface_layout(width, height, mips, element_bytes, block, tile)(tools/tex_headers.py:401-415): Rejectsbooland non-intvalues forwidth,height,mips,element_bytes,block, andtilewithValueError(instead of acceptingTrueas1or raisingAttributeErroronfloat.bit_length()).Scope & Conflict Check
decode_etpf_chunk_pages()(tools/tex_headers.py:355-357) andcompact_surface_layout()(tools/tex_headers.py:401-415), plus added a dedicated synthetic unit test filetests/test_tex_headers_validation.py.tex_headers.py(tex_headers: decode texture dictionary system pages and verify DXGI formats (ASSET-274) #3491, tex_headers: preflight the --out parent before scanning #3572, tex_headers: report input directory errors cleanly (BUILD-1484) #4948, tex_headers: use the shared report path guard (BUILD-589 follow-up) #5981, tools: use report_paths.same_report_path in bvh_index, rbf0_index, and tex_headers #7973, restofworld_index, gamedata_maps, tex_headers: read the carve index with utf-8-sig #6388).Verification
AI-assisted. Tested on Windows 11, Python 3.12.10 (GPU: AMD Radeon RX 9070, driver
32.0.32029.2010; CPU-only tests, synthetic inputs only, zero game data):python -I tests/test_tex_headers_validation.pypython -I tests/test_tex_headers.pypython -I tests/test_tex_headers_report_paths.pypython -m compileall -q make_game.py tools testspython -I scripts/check_no_game_data.py tools/tex_headers.py tests/test_tex_headers_validation.py