Uploaded image for project: 'Directory ApacheDS'
  1. Directory ApacheDS
  2. DIRSERVER-2408

Exceptions in EntrySerializer

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.0.0.AM28
    • jdbm
    • None

    Description

      Class: EntrySerializer
      Method: deserialize()

      I performed fuzz testing of the deserialize() method of EntrySerializer object (for example I took ServerEntrySerializerTest class). In result of fuzzing tests there are some unhandled exceptions:

      1. OutOfMemoryError when running with '-Xmx1620m' option while create massive with size value from input data (look DEDUP_TOKEN: 3c53e16103f7df69, 0e0655117383aa9c, bac12c1dd0658676 in fuzzer_output.txt)

      2. NegativeArraySizeException in readExternal() method in line 184 (DEDUP_TOKEN: c027ed383c214f09 in fuzzer_output.txt) and 219 (DEDUP_TOKEN: 52fd84779ea9dc9e, d13ede94b076c4f2 in fuzzer_output.txt). Values are using incorrect when create byte[] ([ here|https://github.com/apache/directory-ldap-api/blob/bc63cabe199905158578dbf4936eb60fcd6ae4b4/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/Value.java#L1622] and here )

      3. IllegalArgumentException with when add attribute in line 221 (DEDUP_TOKEN: 75318c370e556bae in fuzzer_output.txt).

      4. NullPointerException in line 184 when calling readExternal() (DEDUP_TOKEN: e8c7485e75d40809, 368480f2ec2323a7 in fuzzer_output.txt). SchemaUtils.stripOptions() takes Null string

      5. ArrayIndexOutOfBoundsException in line 213 (DEDUP_TOKEN: 171eddc8777f746e in fuzzer_output.txt)

      this may not pose a threat to apacheds, but there is no handling of it in this area of ​​code. Perhaps should you add another exception types (or base Exception) to the deserialize() function signature, or wrap the specified methods in try/catch blocks?

      Secondly, my tests compared the result of deserialization into a ServerEntry object and serialization into a set of bytes back with the input bytes. Is this correct that in some cases there are sets of bytes that did not match entry value, but correctly deserializing into ServerEntry object? Important to say, that in 60 seconds of working jazzer it was 80k+ executed units and found ~10k mismatched input and output bytes (that is strange, imho). Example of these input samples, crash samples, fuzz test, jazzer log are below

      Attachments

        1. NegativeArraySizeException_entrySerializercrash-64473e185b8cb9d1a448ac522e160174375941e3
          0.1 kB
          Ekaterina Zilotina
        2. NullPointerException_entrySerializercrash-60a07478c87366934a3b0dce34f0f2067f84f154
          0.0 kB
          Ekaterina Zilotina
        3. NegativeArraySizeException_entrySerializercrash-ac848f2d23a9f12ddf250f529c3fe654eef5b233
          0.3 kB
          Ekaterina Zilotina
        4. NegativeArraySizeException_entrySerializercrash-eeb4c93175ddce8ebc177647324566d4c5e3ca61
          0.0 kB
          Ekaterina Zilotina
        5. NullPointerException_entrySerializercrash-085a2198d7a7a20a61c7f16fd90ef3129068bb1b
          0.0 kB
          Ekaterina Zilotina
        6. OutOfMemoryError_entrySerializercrash-1fc0f54909703034301896bca67ba829d81bfa66
          0.2 kB
          Ekaterina Zilotina
        7. DeserializeFuzzer.java.txt
          7 kB
          Ekaterina Zilotina
        8. OutOfMemoryError_entrySerializercrash-4bdb2cd90ef530efe10247e208023c6ec2f15d6f
          0.3 kB
          Ekaterina Zilotina
        9. OutOfMemoryError_entrySerializercrash-c4b87b00b80bf9024e4f693271bf51f02a9f076a
          0.2 kB
          Ekaterina Zilotina
        10. dismatch-errorFile-01dcbb78-1a94-4620-bf4d-115f31f678c1
          0.0 kB
          Ekaterina Zilotina
        11. dismatch-errorFile-01842911-6276-4fda-88f4-7515b30cdafe
          0.2 kB
          Ekaterina Zilotina
        12. ArrayIndexOutOfBoundsException_entrySerializercrash-bb662918c3c5b52aef5bb949285ae5cd46db2900
          0.0 kB
          Ekaterina Zilotina
        13. IllegalArgumentException_entrySerializercrash-89989028ed53bb2aa1611da91746de61252b1095
          0.3 kB
          Ekaterina Zilotina
        14. dismatch-errorFile-01a9c722-588d-4299-b95a-e79d2d2fe9a6
          0.0 kB
          Ekaterina Zilotina
        15. jazzer_output.txt
          157 kB
          Ekaterina Zilotina

        Activity

          People

            Unassigned Unassigned
            zilotinaed Ekaterina Zilotina
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: