On Fri, 25 Sep 2020 02:47:59 GMT, Valerie Peng <valer...@openjdk.org> wrote:

>> src/java.base/share/classes/sun/security/util/DerValue.java line 638:
>> 
>>> 636:         }
>>> 637:         if (end == start) {
>>> 638:             throw new IOException("No padding");
>> 
>> Well, I find the original error message is clearer: Invalid encoding: zero 
>> length bit string. Just the "No padding" may
>> be somewhat unclear since no padding is needed when it's multiple of 8. Or, 
>> maybe something like
>> "DerValue.getBitString, empty value".
>
> It also seems strange that it only checks that length !=0. The spec of 
> BitString seems to suggest the length must
> be >=2 where the first byte is the number of padding bits. It seems that the 
> right check should be (end - start) > 1?

I'll look into it. If there's anything wrong, will fix and add a regression 
test. What if there is zero bit?

And yes, the old exception message is better. Don't know why I modified it.

-------------

PR: https://git.openjdk.java.net/jdk/pull/232

Reply via email to