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

ASF subversion and git services commented on SOLR-18620:
--------------------------------------------------------

Commit 5a809694725776202bf27de84b2f46f4458807de in solr's branch 
refs/heads/main from Ian Springer
[ https://gitbox.apache.org/repos/asf?p=solr.git;h=5a809694725 ]

SOLR-18620: validate preFetchDocs and clear the ValueSourceAugmenter prefetch 
cache (#5290)

An invalid preFetchDocs param (non-numeric or negative) now returns a 400 error 
instead of a 500.

Co-authored-by: Ian Springer <[email protected]>
Co-authored-by: Claude <[email protected]>

> ValueSourceAugmenter: invalid preFetchDocs returns 500; stale prefetch cache 
> when a context has no DocList
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: SOLR-18620
>                 URL: https://issues.apache.org/jira/browse/SOLR-18620
>             Project: Solr
>          Issue Type: Bug
>          Components: search
>    Affects Versions: 9.9, 10.0
>            Reporter: Ian Springer
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> SOLR-17775 added prefetching of function values to ValueSourceAugmenter. That 
> change has three problems:
> 1. preFetchDocs is read with Integer.parseInt and is never validated.
>    - preFetchDocs=abc throws a NumberFormatException. SolrReturnFields only 
> catches SyntaxError, so the request fails with a 500.
>    - preFetchDocs=-1 causes new int[-1] in setContext, which throws a 
> NegativeArraySizeException, also a 500.
>    Both should return 400 BAD_REQUEST.
> 2. The public constructor now calls qparser.getParam(...). Code that passes a 
> null QParser used to work, because the parser was only stored, and now gets 
> an NPE.
> 3. When setContext gets a context with no DocList (for example from RTG), it 
> returns before replacing cachedValuesById. If the same transformer instance 
> was used before, values cached against the earlier searcher can be returned 
> for docids on the new one.
> The existing TestValueSourceAugmenterPrefetchLimit only checks numFound and 
> score. It never checks the function value itself, so none of these problems 
> are caught.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to