Repository navigation
Bound the hash list of a cross compare and report what it ignored once - #280
Merged
Merged
Conversation
cross_compare_from_hash_list looked up every pasted line, repeats included, with one backend request each, and flashed a message per line it ignored. Flashes live in the cookie session, which passed the 4093 bytes a browser keeps at about 70 unknown hashes, so a long list ended with none of the messages shown. Lines are now deduplicated and lowercased (the corpus stores lowercase hashes and the backend matches exactly), the list is cut at 250 hashes like the unique blocks selection, and the ignored lines are reported in one warning each for malformed and unknown hashes, naming the first five.
This was referenced Oct 9, 2026
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.
/analyze/cross_compare_from_hash_listlooks every pasted line up withgetSampleBySha256, one backend request per line, with no limit and repeats included. For every line it ignores it flashes a message of its own. Flashes are stored in Flask's cookie session, so a list of mostly unknown hashes (say, sample hashes from a report, few of them in this corpus) outgrows what a browser keeps: in the test client, 100 random hashes made a 5692-byte session cookie, and Werkzeug warns that browsers may ignore anything past 4093. The page then shows none of the messages. The lookups themselves were measured in an earlier review at 7000 requests in 11.5 s for a 455 KB list.Change. In
cross_compare_from_hash_list(mcritweb/views/analyze.py:210-240):hexdigest()and the backend matches exactly, so an uppercase hash named no sample before; a repeated one selected the same sample twice.MAX_HASH_LIST_LENGTHdistinct hashes before any lookup (analyze.py:27,:225), with one warning saying how many were dropped. It is the same 250 asMAX_SELECTED_SAMPLES, the bound the unique blocks selection already has; the form label names it (mcritweb/templates/cross_compare_from_hash_list.html:25).analyze.py:33,:221,:238). Flash messages are autoescaped inbase.html, as before.Verification. On the live testbed (mcrit 1.13.0), master on :5000 against this branch on a side instance, the same pasted list: three known hashes, the first one again in upper case and once more as is, 100 random hashes and one malformed line. curl as the client, which, like a browser, drops a cookie over 4096 bytes.
Set-Cookieheader of the POSTsamplesin the redirect0,1,2,00,1,2Measured on 1734122; the commit was then amended only to deduplicate with
dict.fromkeysinstead of a list membership test, which was quadratic before the cap applied, and to write the cap out in the tests. The outputs are the same. Only lookups were sent, and the corpus check afterwards reports it unchanged.Tests.
tests/testCrossCompareHashList.py, new:MAX_HASH_LIST_LENGTH.All six fail with master's
analyze.pyand template: the first five on behaviour, the last because master has no such constant.Relation to open PRs. A trial merge (
git merge-tree, against this head) with #219, #244, #253 and #271 to #279 is clean. #174 edits thesearch_page()call of this route and already conflicts with master inanalyze.py; the set of conflicting files is the same with and without this branch.Left out. The
findLoopscost on large graphs (cfg_explorer_detector.py), found in the same review, is not touched here: #270 changes that view, so a change there should follow it.