Uploaded image for project: 'James Server'
  1. James Server
  2. JAMES-3611

SearchUtil getBaseSubject throws on empty input

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • master, 3.6.0
    • 3.7.0
    • mailbox

    Description

      Character reading is not properly sanitized.

      java.lang.StringIndexOutOfBoundsException: String index out of range: -1
      	at java.base/java.lang.StringLatin1.charAt(StringLatin1.java:47)
      	at java.base/java.lang.String.charAt(String.java:693)
      	at org.apache.james.mailbox.store.search.SearchUtil.removeSubTrailers(SearchUtil.java:413)
      	at org.apache.james.mailbox.store.search.SearchUtil.getBaseSubject(SearchUtil.java:246)
      	at org.apache.james.mailbox.store.mail.SearchThreadIdGuessingAlgorithm.lambda$buildSearchQuery$2(SearchThreadIdGuessingAlgorithm.java:81)
      	at java.base/java.util.Optional.map(Optional.java:265)
      	at org.apache.james.mailbox.store.mail.SearchThreadIdGuessingAlgorithm.buildSearchQuery(SearchThreadIdGuessingAlgorithm.java:81)
      	at org.apache.james.mailbox.store.mail.SearchThreadIdGuessingAlgorithm.guessThreadIdReactive(SearchThreadIdGuessingAlgorithm.java:60)
      	at org.apache.james.mailbox.store.MessageStorer$WithAttachment.appendMessageToStore(MessageStorer.java:106)
      	at org.apache.james.mailbox.store.StoreMessageManager.createAndDispatchMessage(StoreMessageManager.java:519)
      	at org.apache.james.mailbox.store.StoreMessageManager.lambda$appendMessage$2(StoreMessageManager.java:409)
      	at reactor.core.publisher.MonoCallable.call(MonoCallable.java:91)
      	at reactor.core.publisher.FluxFlatMap.trySubscribeScalarMap(FluxFlatMap.java:126)
      	at reactor.core.publisher.MonoFlatMap.subscribeOrReturn(MonoFlatMap.java:53)
      	at reactor.core.publisher.Mono.subscribe(Mono.java:4031)
      	at reactor.core.publisher.MonoSubscribeOn$SubscribeOnSubscriber.run(MonoSubscribeOn.java:126)
      	at reactor.core.scheduler.WorkerTask.call(WorkerTask.java:84)
      	at reactor.core.scheduler.WorkerTask.call(WorkerTask.java:37)
      	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      	at java.base/java.lang.Thread.run(Thread.java:834)
      

      An empty subject reproduces this.

      Affected combonents: Lucene search & scanning search (subject)

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              btellier Benoit Tellier
              Votes:
              0 Vote for this issue
              Watchers:
              1 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 - 20m
                  20m