The CVE-2026-81722 patch in NLTK 3.10.3 fixed an O(n²) regression in the PorterStemmer's _is_consonant() function, where the algorithm walked backward over trailing 'y' runs on every call. That fix deserves as much scrutiny as the original vulnerability — possibly more, because the blast radius of a behavioral change in a deterministic text processor is quieter than CPU exhaustion but far more insidious.

The core issue: the _is_consonant() method uses stateful lookahead to classify 'y' based on context — it must determine whether a trailing 'y' functions as a vowel (as in "rhythm") or consonant (as in "yes"). The 3.10.3 patch restructured this iteration pattern, and the classification logic is sensitive to edge cases in English orthography. If the fix altered how trailing 'y' runs are classified, downstream systems that cache, index, or train on stemmed output will silently accumulate divergent data. Search indexes rebuilt after the upgrade will return different results than queries tokenized with the old version. Deduplication pipelines that group documents by stemmed tokens will produce inconsistent clusters. Models trained on pre-patch stemming operate in a subtly different feature space than post-patch deployments.

This matters most in modern ML pipelines: RAG systems, vector database ingestion, automated document processing, and any preprocessing layer that normalizes untrusted user content at scale. The attack surface isn't the stemmer directly — it's the pipeline that feeds user content through NLTK tokenization and stemming before embedding or indexing. A malicious input doesn't need to pin your CPU during indexing (the DoS vector); it can shift which text chunks get grouped together by causing your stemmer to behave differently than your indexing logic expects.

Before upgrading to 3.10.3, run your actual corpus through before/after stemming comparison. Treat the patch as potentially behavior-changing, not just a security fix. Verify that your downstream systems — search indexes, caches, trained models, deduplication jobs — can tolerate output divergence, or plan to rebuild affected indexes post-upgrade. The PorterStemmer has been treated as a pure function for decades; the vulnerability reminded us it never was.