[
https://issues.apache.org/jira/browse/RAT-589?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18144436#comment-18144436
]
ASF subversion and git services commented on RAT-589:
-----------------------------------------------------
Commit a4e08004fd57b493cd6af042ade9bca3590300f9 in creadur-rat's branch
refs/heads/master from Philipp Ottlinger
[ https://gitbox.apache.org/repos/asf?p=creadur-rat.git;h=a4e08004f ]
RAT-589: Raise header worker line limit to 400
> Header line limit is dead code — whole files buffered in memory and fed to
> quadratic license-matcher regexes
> ------------------------------------------------------------------------------------------------------------
>
> Key: RAT-589
> URL: https://issues.apache.org/jira/browse/RAT-589
> Project: Apache RAT
> Issue Type: Bug
> Affects Versions: 0.18
> Reporter: Philipp Ottlinger
> Priority: Major
> Fix For: 0.19
>
>
> Header line limit is dead code — whole files buffered in memory and fed to
> quadratic license-matcher regexes
> in
> apache-rat-core/src/main/java/org/apache/rat/analysis/HeaderCheckWorker.java
> readHeader() declared headerLinesRead, tested it in the loop condition
> (headerLinesRead < numberOfLines), but never incremented it, so the
> documented DEFAULT_NUMBER_OF_RETAINED_HEADER_LINES=50 bound was dead code and
> every scanned file was buffered in full (twice: raw + pruned copy) and fed to
> the SPDX/copyright matcher regexes. The one-line fix (headerLinesRead++ in
> the loop body) restores the documented behavior; with the bound live, the
> downstream quadratic regex costs (SPDXMatcherFactory GROUP_SELECTOR greedy .*
> prefix, CopyrightMatcher find()/start()==0) are capped to 50 lines of input
> per file. The bound is already configurable: the
> HeaderCheckWorker(generatedMatcher, reader, numberOfRetainedHeaderLine,
> licenses, document) constructor takes the line count and the convenience
> constructor passes the documented default of 50; no new option plumbing
> needed.
> This issue was found using Claude agents to study the security of open-source
> projects (finder)
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)