Yongjun Zhang created HADOOP-11453:
--------------------------------------
Summary: Invalid mapping can be inserted to nfs's id-name map
Key: HADOOP-11453
URL: https://issues.apache.org/jira/browse/HADOOP-11453
Project: Hadoop Common
Issue Type: Bug
Components: nfs
Reporter: Yongjun Zhang
Assignee: Yongjun Zhang
See pasted code below from {{ShellBasedIdMapping#updateMapInternal}}, LineA
could return null value when the entry is not in the static mapping. Since
{{map}} allows null key, so it's possible that lineB would add entry <null,
value> to the {{map}}. This is not the desired behavior.
{code}
final Integer key = staticMapping.get(parseId(nameId[1])); <====lineA
final String value = nameId[0];
if (map.containsKey(key)) {
final String prevValue = map.get(key);
if (value.equals(prevValue)) {
// silently ignore equivalent entries
continue;
}
reportDuplicateEntry(
"Got multiple names associated with the same id: ",
key, value, key, prevValue);
continue;
}
if (map.containsValue(value)) {
final Integer prevKey = map.inverse().get(value);
reportDuplicateEntry(
"Got multiple ids associated with the same name: ",
key, value, prevKey, value);
continue;
}
map.put(key, value); <==== lineB
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)