Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-16177

File stream cache problem with multicast parallel processing and encrypted stream

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.25.3, 3.7.2
    • Fix Version/s: 2.25.2, 3.7.3, 3.8.0, 3.9.0
    • Component/s: camel-core
    • Labels:
      None
    • Patch Info:
      Patch Available
    • Estimated Complexity:
      Unknown

      Description

      If you use stream caching with file encryption in a camel route where you have a multicast with several branches, then it the following errors can happen in the message processing of the branch.

      • When the message is processed in a branch you can get the following exception:aused by: java.lang.ArrayIndexOutOfBoundsException: while trying to load from index 16 of a byte (or boolean) array with length 16, loaded from field com.sun.crypto.provider.CounterMode.encryptedCounter of an object loaded from local variable 'this'aused by: java.lang.ArrayIndexOutOfBoundsException: while trying to load from index 16 of a byte (or boolean) array with length 16, loaded from field com.sun.crypto.provider.CounterMode.encryptedCounter of an object loaded from local variable 'this' at com.sun.crypto.provider.CounterMode.implCrypt(CounterMode.java:190) at com.sun.crypto.provider.CounterMode.crypt(CounterMode.java:178) at com.sun.crypto.provider.CounterMode.decrypt(CounterMode.java:153) at com.sun.crypto.provider.CipherCore.update(CipherCore.java:782) at com.sun.crypto.provider.CipherCore.update(CipherCore.java:667) at com.sun.crypto.provider.AESCipher.engineUpdate(AESCipher.java:380) at javax.crypto.Cipher.update(Cipher.java:1835) at javax.crypto.CipherInputStream.getMoreData(CipherInputStream.java:139) at javax.crypto.CipherInputStream.read(CipherInputStream.java:199) at org.apache.camel.converter.stream.FileInputStreamCache.read(FileInputStreamCache.java:139)
      • or you get a damaged payload in the branch which is not correctly decrypted

      The root cause of the problem is that the decryptor is not thread safe: If two different FileInputStreamCache instances use the same decryptor in two different threads at the same time, the above problems occur.

      I will provide a patch for this problem.

       

        Attachments

          Activity

            People

            • Assignee:
              forsthofer Franz Forsthofer
              Reporter:
              forsthofer Franz Forsthofer
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: