diff options
| author | xel1uz <16402913+xel1uz@users.noreply.github.com> | 2026-11-25 06:33:03 +0100 |
|---|---|---|
| committer | xel1uz <16402913+xel1uz@users.noreply.github.com> | 2026-11-25 06:33:03 +0100 |
| commit | 672dba76f99afc0439472116c3e5baf5b00ff49d (patch) | |
| tree | b3afb7ff71de77fd9aec26ab1ddb264265ff61e2 /runtime/src/xma2_decoder.cpp | |
| parent | c7e82e26eadeac237da66949b64e7a52b718361e (diff) | |
amd_swizzle: reject impossible sizes, unusable offsets and empty results
amd_swizzle.py turned bad arguments into tracebacks or into a silent success:
- --width 0 or --height 0 crashed in Pillow with UnidentifiedImageError, and a
negative size crashed in numpy with "negative dimensions are not allowed",
because the guards only checked --out and the blob path.
- A negative --offset sliced from the end of the blob, and an offset past the
end left an empty buffer; both exited 0 and wrote no image.
- A --modes value matching no pattern table produced no line at all, so a
caller could not tell success from a mistyped mode.
- The default header path is a Windows-shaped placeholder, so on a host
without the file the tool died in a raw FileNotFoundError.
Each case now prints one ERROR line and exits 2 before any work starts, and a
missing or malformed gfx10SwizzlePattern.h names AMD_SWIZZLE_HEADER instead of
raising. A valid run is unchanged.
Tests: the six cases above exercise the CLI with a synthetic header; five of
them fail on c7e82e26 and pass here, and the valid-run test passes on both.
Diffstat (limited to 'runtime/src/xma2_decoder.cpp')
0 files changed, 0 insertions, 0 deletions