Clam 1106 clamdscan allmatch stickiness#741
Merged
val-ms merged 2 commits intoCisco-Talos:mainfrom Nov 4, 2022
Merged
Conversation
Test that clamdscan --allmatch does not cause future clamdscans to run in allmatch mode.
If you run clamdscan with the --allmatch option, it will cause all subsequent clamdscan scans to have all-match mode enabled. This bug is specific to clamd / clamdscan and does not affect clamscan. The problem was introduced when we converted the scan options from a single integer bitfield to a struct. The scan options set by the clamdscan parameters should be saved in a local copy of the scan options, but instead it is saving a copy of the pointer to the scan options struct, and so any changes to the scan options affect future scans.
kirkham
approved these changes
Nov 2, 2022
m-sola
approved these changes
Nov 4, 2022
Contributor
m-sola
left a comment
There was a problem hiding this comment.
Comparison testing by running clamd, then clamdscan 3 times (no allmatch, allmatch, no allmatch):
In the previous version the last scan gave allmatch results.
Same test on this PR fixes that.
The code itself is straightforward. No issues there.
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.
Fix clamdscan --allmatch stickiness bug
If you run clamdscan with the --allmatch option, it will cause all
subsequent clamdscan scans to have all-match mode enabled.
This bug is specific to clamd / clamdscan and does not affect clamscan.
The problem was introduced when we converted the scan options from a
single integer bitfield to a struct. The scan options set by the
clamdscan parameters should be saved in a local copy of the scan
options, but instead it is saving a copy of the pointer to the scan
options struct, and so any changes to the scan options affect future
scans.
Test: Add clamdscan --allmatch stickiness regression test
Test that clamdscan --allmatch does not cause future clamdscans to run
in allmatch mode.
Fixes #276