commit | b02e9dea1e7f4c6ef10697bb1cdaf8363626d1e4 | [log] [tgz] |
---|---|---|
author | Paul Lietar <lietar@google.com> | Mon Oct 05 18:55:45 2015 +0100 |
committer | Kenny Root <kroot@google.com> | Mon Oct 05 20:06:33 2015 +0000 |
tree | d580e9294bf97d9807749bb4f7c76c1db984ec2b | |
parent | 126ec77aacd58c8b5d62d433af65386fa3dd3fc1 [diff] |
Fix parsing of long format DER octet string. When parsing a DER octet string of more than 128 bytes, the "long format" flag, which is the most significant bit, is set on the length byte. When Java does a signed upcast from byte to int, it sign extends it and all the high bits are set. This causes to width to be negative. Use readNumber instead which takes care of the upcast properly. Also adds test to verify the behaviour. Change-Id: I6f700ac2970eac4bd7e18ed0776d64cb91277acd