Review Request for JDK-8003992: File and other classes in java.io do not handle embedded nulls properly
mike.duigou at oracle.com
Wed Feb 27 18:31:43 UTC 2013
Ouch. That is unfortunate that File cannot reject bad input.
Perhaps FileInputStream etc. should throw a specialized "Bad Filename" FnF for paths containing NUL if the underlying filesystem does not support NUL?
Masking garbage input always really scares me.
On Feb 27 2013, at 02:40 , Alan Bateman wrote:
> On 27/02/2013 02:31, Dan Xu wrote:
>> Thank you, Mike.
>> The reason not to throw out an exception is for the backward compatibility. Due to that, the constructorof File object with NUL willnever fail.While in NIO, it is defined in the spec to throw out exceptions when invalid NUL character is found.
> Right, we can't change the constructor to throw an exception, particularly if this fix is going to be back-ported to 7u. For NIO then it's not an issue because getPath was specified from the begining to throw the unexpected InvalidPathException when it is given garbage.
More information about the core-libs-dev