Hadoop Common
  1. Hadoop Common
  2. HADOOP-10542

Potential null pointer dereference in Jets3tFileSystemStore#retrieveBlock()

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.6.0
    • Fix Version/s: 2.7.0
    • Component/s: fs/s3
    • Labels:
      None
    • Target Version/s:

      Description

            in = get(blockToKey(block), byteRangeStart);
            out = new BufferedOutputStream(new FileOutputStream(fileBlock));
            byte[] buf = new byte[bufferSize];
            int numRead;
            while ((numRead = in.read(buf)) >= 0) {
      

      get() may return null.
      The while loop dereferences in without null check.

        Activity

        Hide
        Hudson added a comment -

        FAILURE: Integrated in Hadoop-Mapreduce-trunk #2028 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk/2028/)
        HADOOP-10542 Potential null pointer dereference in Jets3tFileSystemStore retrieveBlock(). (Ted Yu via stevel) (stevel: rev c6c0f4eb25e511944915bc869e741197f7a277e0)

        • hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3/Jets3tFileSystemStore.java
        • hadoop-common-project/hadoop-common/CHANGES.txt
        Show
        Hudson added a comment - FAILURE: Integrated in Hadoop-Mapreduce-trunk #2028 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk/2028/ ) HADOOP-10542 Potential null pointer dereference in Jets3tFileSystemStore retrieveBlock(). (Ted Yu via stevel) (stevel: rev c6c0f4eb25e511944915bc869e741197f7a277e0) hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3/Jets3tFileSystemStore.java hadoop-common-project/hadoop-common/CHANGES.txt
        Hide
        Hudson added a comment -

        FAILURE: Integrated in Hadoop-Mapreduce-trunk-Java8 #78 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk-Java8/78/)
        HADOOP-10542 Potential null pointer dereference in Jets3tFileSystemStore retrieveBlock(). (Ted Yu via stevel) (stevel: rev c6c0f4eb25e511944915bc869e741197f7a277e0)

        • hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3/Jets3tFileSystemStore.java
        • hadoop-common-project/hadoop-common/CHANGES.txt
        Show
        Hudson added a comment - FAILURE: Integrated in Hadoop-Mapreduce-trunk-Java8 #78 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk-Java8/78/ ) HADOOP-10542 Potential null pointer dereference in Jets3tFileSystemStore retrieveBlock(). (Ted Yu via stevel) (stevel: rev c6c0f4eb25e511944915bc869e741197f7a277e0) hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3/Jets3tFileSystemStore.java hadoop-common-project/hadoop-common/CHANGES.txt
        Hide
        Hudson added a comment -

        FAILURE: Integrated in Hadoop-Hdfs-trunk-Java8 #74 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk-Java8/74/)
        HADOOP-10542 Potential null pointer dereference in Jets3tFileSystemStore retrieveBlock(). (Ted Yu via stevel) (stevel: rev c6c0f4eb25e511944915bc869e741197f7a277e0)

        • hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3/Jets3tFileSystemStore.java
        • hadoop-common-project/hadoop-common/CHANGES.txt
        Show
        Hudson added a comment - FAILURE: Integrated in Hadoop-Hdfs-trunk-Java8 #74 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk-Java8/74/ ) HADOOP-10542 Potential null pointer dereference in Jets3tFileSystemStore retrieveBlock(). (Ted Yu via stevel) (stevel: rev c6c0f4eb25e511944915bc869e741197f7a277e0) hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3/Jets3tFileSystemStore.java hadoop-common-project/hadoop-common/CHANGES.txt
        Hide
        Hudson added a comment -

        FAILURE: Integrated in Hadoop-Hdfs-trunk #2009 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk/2009/)
        HADOOP-10542 Potential null pointer dereference in Jets3tFileSystemStore retrieveBlock(). (Ted Yu via stevel) (stevel: rev c6c0f4eb25e511944915bc869e741197f7a277e0)

        • hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3/Jets3tFileSystemStore.java
        • hadoop-common-project/hadoop-common/CHANGES.txt
        Show
        Hudson added a comment - FAILURE: Integrated in Hadoop-Hdfs-trunk #2009 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk/2009/ ) HADOOP-10542 Potential null pointer dereference in Jets3tFileSystemStore retrieveBlock(). (Ted Yu via stevel) (stevel: rev c6c0f4eb25e511944915bc869e741197f7a277e0) hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3/Jets3tFileSystemStore.java hadoop-common-project/hadoop-common/CHANGES.txt
        Hide
        Hudson added a comment -

        FAILURE: Integrated in Hadoop-Yarn-trunk #811 (See https://builds.apache.org/job/Hadoop-Yarn-trunk/811/)
        HADOOP-10542 Potential null pointer dereference in Jets3tFileSystemStore retrieveBlock(). (Ted Yu via stevel) (stevel: rev c6c0f4eb25e511944915bc869e741197f7a277e0)

        • hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3/Jets3tFileSystemStore.java
        • hadoop-common-project/hadoop-common/CHANGES.txt
        Show
        Hudson added a comment - FAILURE: Integrated in Hadoop-Yarn-trunk #811 (See https://builds.apache.org/job/Hadoop-Yarn-trunk/811/ ) HADOOP-10542 Potential null pointer dereference in Jets3tFileSystemStore retrieveBlock(). (Ted Yu via stevel) (stevel: rev c6c0f4eb25e511944915bc869e741197f7a277e0) hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3/Jets3tFileSystemStore.java hadoop-common-project/hadoop-common/CHANGES.txt
        Hide
        Hudson added a comment -

        FAILURE: Integrated in Hadoop-Yarn-trunk-Java8 #77 (See https://builds.apache.org/job/Hadoop-Yarn-trunk-Java8/77/)
        HADOOP-10542 Potential null pointer dereference in Jets3tFileSystemStore retrieveBlock(). (Ted Yu via stevel) (stevel: rev c6c0f4eb25e511944915bc869e741197f7a277e0)

        • hadoop-common-project/hadoop-common/CHANGES.txt
        • hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3/Jets3tFileSystemStore.java
        Show
        Hudson added a comment - FAILURE: Integrated in Hadoop-Yarn-trunk-Java8 #77 (See https://builds.apache.org/job/Hadoop-Yarn-trunk-Java8/77/ ) HADOOP-10542 Potential null pointer dereference in Jets3tFileSystemStore retrieveBlock(). (Ted Yu via stevel) (stevel: rev c6c0f4eb25e511944915bc869e741197f7a277e0) hadoop-common-project/hadoop-common/CHANGES.txt hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3/Jets3tFileSystemStore.java
        Hide
        Hudson added a comment -

        FAILURE: Integrated in Hadoop-trunk-Commit #6882 (See https://builds.apache.org/job/Hadoop-trunk-Commit/6882/)
        HADOOP-10542 Potential null pointer dereference in Jets3tFileSystemStore retrieveBlock(). (Ted Yu via stevel) (stevel: rev c6c0f4eb25e511944915bc869e741197f7a277e0)

        • hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3/Jets3tFileSystemStore.java
        • hadoop-common-project/hadoop-common/CHANGES.txt
        Show
        Hudson added a comment - FAILURE: Integrated in Hadoop-trunk-Commit #6882 (See https://builds.apache.org/job/Hadoop-trunk-Commit/6882/ ) HADOOP-10542 Potential null pointer dereference in Jets3tFileSystemStore retrieveBlock(). (Ted Yu via stevel) (stevel: rev c6c0f4eb25e511944915bc869e741197f7a277e0) hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3/Jets3tFileSystemStore.java hadoop-common-project/hadoop-common/CHANGES.txt
        Hide
        Steve Loughran added a comment -

        +1, committing

        Show
        Steve Loughran added a comment - +1, committing
        Hide
        Hadoop QA added a comment -

        -1 overall. Here are the results of testing the latest attachment
        http://issues.apache.org/jira/secure/attachment/12692922/hadoop-10542-001.patch
        against trunk revision 43302f6.

        +1 @author. The patch does not contain any @author tags.

        -1 tests included. The patch doesn't appear to include any new or modified tests.
        Please justify why no new tests are needed for this patch.
        Also please list what manual steps were performed to verify this patch.

        +1 javac. The applied patch does not increase the total number of javac compiler warnings.

        +1 javadoc. There were no new javadoc warning messages.

        +1 eclipse:eclipse. The patch built with eclipse:eclipse.

        +1 findbugs. The patch does not introduce any new Findbugs (version 2.0.3) warnings.

        +1 release audit. The applied patch does not increase the total number of release audit warnings.

        +1 core tests. The patch passed unit tests in hadoop-tools/hadoop-aws.

        Test results: https://builds.apache.org/job/PreCommit-HADOOP-Build/5422//testReport/
        Console output: https://builds.apache.org/job/PreCommit-HADOOP-Build/5422//console

        This message is automatically generated.

        Show
        Hadoop QA added a comment - -1 overall . Here are the results of testing the latest attachment http://issues.apache.org/jira/secure/attachment/12692922/hadoop-10542-001.patch against trunk revision 43302f6. +1 @author . The patch does not contain any @author tags. -1 tests included . The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch. +1 javac . The applied patch does not increase the total number of javac compiler warnings. +1 javadoc . There were no new javadoc warning messages. +1 eclipse:eclipse . The patch built with eclipse:eclipse. +1 findbugs . The patch does not introduce any new Findbugs (version 2.0.3) warnings. +1 release audit . The applied patch does not increase the total number of release audit warnings. +1 core tests . The patch passed unit tests in hadoop-tools/hadoop-aws. Test results: https://builds.apache.org/job/PreCommit-HADOOP-Build/5422//testReport/ Console output: https://builds.apache.org/job/PreCommit-HADOOP-Build/5422//console This message is automatically generated.
        Hide
        Steve Loughran added a comment -

        IOE: it's the only thing that ensures callers won't themselves NPE

        Show
        Steve Loughran added a comment - IOE: it's the only thing that ensures callers won't themselves NPE
        Hide
        Ted Yu added a comment -

        If in is null, do we return an empty fileBlock or raise exception ?
        I lean toward the latter. e.g. raise IOE with message saying object with key blockToKey(block) wasn't found.

        Show
        Ted Yu added a comment - If in is null, do we return an empty fileBlock or raise exception ? I lean toward the latter. e.g. raise IOE with message saying object with key blockToKey(block) wasn't found.
        Hide
        Steve Loughran added a comment -

        this still exists in 2.6. Ted: do you have a patch for this?

        Show
        Steve Loughran added a comment - this still exists in 2.6. Ted: do you have a patch for this?
        Hide
        Steve Loughran added a comment -

        I think we need to look at why the error "NoSuchKey" is being mapped to null, rather than raise an exception -and for the selective reporting in handleServiceException(). Do that -and provide a useful error, and the deref here goes away.

        HADOOP-10533 seems related.

        Show
        Steve Loughran added a comment - I think we need to look at why the error "NoSuchKey" is being mapped to null , rather than raise an exception -and for the selective reporting in handleServiceException() . Do that -and provide a useful error, and the deref here goes away. HADOOP-10533 seems related.

          People

          • Assignee:
            Ted Yu
            Reporter:
            Ted Yu
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development