test: gate threaded-abort security tests on the AVX2 reader, not x86_64#460
Merged
Conversation
security_threaded_decode_abort_mt and security_threaded_decode_abort_color_mt rely on the corrupted code-block actually throwing during decode, which only the AVX2 MagSgn reader does — the scalar and NEON readers clamp the over-read and finish with garbage. The tests were registered for every x86_64 target, so an x86_64 build configured with -DENABLE_AVX2=OFF registered them and failed: the PASS_REGULAR_EXPRESSION log line is never printed on the scalar path. Replace the processor match with a compile check that mirrors the source gate (OPENHTJ2K_TRY_AVX2 && __AVX2__): register the tests only when ENABLE_AVX2 is on and __AVX2__ is defined under the active compile flags. Verified: AVX2 build (Zen 5) still registers and passes the tests; an x86_64 build with -DENABLE_AVX2=OFF no longer registers them. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01M9cKpzqghsLxJUu7kkyRAw
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
security_threaded_decode_abort_mtandsecurity_threaded_decode_abort_color_mtverify that a code-block throw on a thread-pool worker is caught cleanly (no hang, no terminate). Their fixtures only throw on the AVX2 MagSgn reader — the scalar and NEON readers clamp the over-read and finish with garbage output instead.The tests were registered for every x86_64 target, so an x86_64 build configured with
-DENABLE_AVX2=OFFregistered them and failed: the scalar reader never prints thePASS_REGULAR_EXPRESSIONlog line.Fix
Register the tests only when the AVX2 block-decoder is actually compiled in:
ENABLE_AVX2plus acheck_cxx_source_compilesprobe for__AVX2__under the active compile flags, mirroring theOPENHTJ2K_TRY_AVX2 && __AVX2__gate in the source. This also keeps the tests off Emscripten and non-AVX2 x86 hosts, where the same clamping behaviour applies.Verification
-DENABLE_AVX2=OFF -DENABLE_ARM_NEON=OFF: tests no longer registered (previously registered and failing).🤖 Generated with Claude Code
https://claude.ai/code/session_01M9cKpzqghsLxJUu7kkyRAw