Uploaded image for project: 'Tika'
  1. Tika
  2. TIKA-2392

Possible bugs in the source code

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

      Description

      Hi!
      I've checked your project with static analyzer AppChecker and it found several suspicious fragments:

      1) tika-core/src/main/java/org/apache/tika/parser/external/ExternalParsersConfigReader.java

      if (element != null && element.getTagName().equals(EXTERNAL_PARSERS_TAG)) {
      ...
      } else {
               throw new MimeTypeException(
                    ...
                     + element.getTagName());
      }
      

      if element is null, code element.getTagName() will be executed, so NPE will be throw.

      2) tika-parsers/src/main/java/org/apache/tika/parser/wordperfect/WP6DocumentAreaExtractor.java#L65-L68

              } else if (c == 129) {
                  out.append('\u00A0'); // Hard space
              } else if (c == 129) {
                  out.append('-');      // Hard hyphen
      

      (c == 129) is checked twice.

      3) tika-parsers/src/main/java/org/apache/tika/parser/audio/MidiParser.java

       } else if (type == Sequence.SMPTE_24) {
        metadata.set("divisionType", "SMPTE_24");
      }
      ...
       } else if (type == Sequence.SMPTE_24) {
          metadata.set("divisionType", String.valueOf(type));
      }
      

      (type == Sequence.SMPTE_24) is checked twice.

      4) tika-parsers/src/main/java/org/apache/tika/parser/ocr/TesseractOCRConfig.java#L398

       if (!colorspace.equals(null)) {
      

      if colorspace is null you will get NullPointerException.

      Same:
      tika-parsers/src/main/java/org/apache/tika/parser/ocr/TesseractOCRConfig.java#L417

      if (filter.equals(null)) {
      

      5) tika-app/src/main/java/org/apache/tika/gui/TikaGUI.java#L640

               if (splitAt > 0) {
                  embeddedName.substring(splitAt);
               }
      

      embeddedName is not changed, because java.lang.String.substring returns new string.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              AppChecker AppChecker

              Dates

              • Created:
                Updated:

                Issue deployment