[ 
https://issues.apache.org/jira/browse/RAT-589?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18144931#comment-18144931
 ] 

ASF subversion and git services commented on RAT-589:
-----------------------------------------------------

Commit 146b60f13cf3a58724e186d1abfc1b0126ad363a in creadur-rat's branch 
refs/heads/dependabot/maven/org.apache.commons-commons-lang3-3.22.0 from P. 
Ottlinger
[ https://gitbox.apache.org/repos/asf?p=creadur-rat.git;h=146b60f13 ]

Merge pull request #772 from apache/fixTestRAT343

RAT-589: Adapt tests to new HeaderCheckerWorker logics

> 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
>            Assignee: 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)
> *Line limit set to 400 lines as default!*



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to