Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-12614

FSPermissionChecker#getINodeAttrs() throws NPE when INodeAttributesProvider configured

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.0.0-beta1
    • 3.0.0, 2.10.0, 2.9.1, 2.8.4
    • None
    • None

    Description

      When INodeAttributesProvider is configured, and when resolving path (like "/") and checking for permission, the following code when working on pathByNameArr throws NullPointerException.

        private INodeAttributes getINodeAttrs(byte[][] pathByNameArr, int pathIdx,
            INode inode, int snapshotId) {
          INodeAttributes inodeAttrs = inode.getSnapshotINode(snapshotId);
          if (getAttributesProvider() != null) {
            String[] elements = new String[pathIdx + 1];
            for (int i = 0; i < elements.length; i++) {
              elements[i] = DFSUtil.bytes2String(pathByNameArr[i]);  <===
            }
            inodeAttrs = getAttributesProvider().getAttributes(elements, inodeAttrs);
          }
          return inodeAttrs;
        }
      

      Looks like for paths like "/" where the split components based on delimiter "/" can be null, the pathByNameArr array can have null elements and can throw NPE.

      Attachments

        1. HDFS-12614.test.01.patch
          3 kB
          Manoj Govindassamy
        2. HDFS-12614.branch-2.patch
          5 kB
          Kihwal Lee
        3. HDFS-12614.04.patch
          5 kB
          Manoj Govindassamy
        4. HDFS-12614.03.patch
          5 kB
          Manoj Govindassamy
        5. HDFS-12614.02.patch
          5 kB
          Manoj Govindassamy
        6. HDFS-12614.01.patch
          4 kB
          Manoj Govindassamy

        Issue Links

          Activity

            People

              manojg Manoj Govindassamy
              manojg Manoj Govindassamy
              Votes:
              0 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: