Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-13207

AIOOBE in calculateMinShouldMatch

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: master (9.0), 8.4
    • Component/s: None
    • Labels:
    • Environment:

      Description

      Requesting the following URL causes Solr to return an HTTP 500 error response:

      http://localhost:8983/solr/films/select?mm=%3C&defType=edismax&q=fq=field(id,1)
      

      The error response seems to be caused by the following uncaught exception:

      java.lang.ArrayIndexOutOfBoundsException: 0
      at org.apache.solr.util.SolrPluginUtils.calculateMinShouldMatch(SolrPluginUtils.java:683)
      at org.apache.solr.util.SolrPluginUtils.setMinShouldMatch(SolrPluginUtils.java:641)
      at org.apache.solr.util.SolrPluginUtils.setMinShouldMatch(SolrPluginUtils.java:660)
      at org.apache.solr.search.ExtendedDismaxQParser.parseOriginalQuery(ExtendedDismaxQParser.java:415)
      at org.apache.solr.search.ExtendedDismaxQParser.parse(ExtendedDismaxQParser.java:173)
      at org.apache.solr.search.QParser.getQuery(QParser.java:173)
      at org.apache.solr.handler.component.QueryComponent.prepare(QueryComponent.java:158)
      at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:272)
      at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:199)
      at org.apache.solr.core.SolrCore.execute(SolrCore.java:2559)
      
      

      The mm parameter is given as ‘<’. It is (after some string mangling) split into sub-strings separated by ‘<’, putattively giving the left-hand and right-hand argument of the operator. In the example, there are no such arguments, so the resulting array “parts” is empty (cf. String.split documentation). But we immediately try to access parts[0], leading to an AIOOBE.

      To set up an environment to reproduce this bug, follow the description in the ‘Environment’ field.

      We automatically found this issue and ~70 more like this using Diffblue Microservices Testing. Find more information on this fuzz testing campaign.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                jkloos Johannes Kloos
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2.5h
                  2.5h