src/java.base/share/classes/sun/security/util/DerIndefLenConverter.java
branchdatagramsocketimpl-branch
changeset 58678 9cf78a70fa4f
parent 54372 9ac5d41abf68
child 58679 9c3209ff7550
equal deleted inserted replaced
58677:13588c901957 58678:9cf78a70fa4f
    90     /**
    90     /**
    91      * Parse the tag and if it is an end-of-contents tag then
    91      * Parse the tag and if it is an end-of-contents tag then
    92      * add the current position to the <code>eocList</code> vector.
    92      * add the current position to the <code>eocList</code> vector.
    93      */
    93      */
    94     private void parseTag() throws IOException {
    94     private void parseTag() throws IOException {
    95         if (dataPos == dataSize)
       
    96             return;
       
    97         if (isEOC(data[dataPos]) && (data[dataPos + 1] == 0)) {
    95         if (isEOC(data[dataPos]) && (data[dataPos + 1] == 0)) {
    98             int numOfEncapsulatedLenBytes = 0;
    96             int numOfEncapsulatedLenBytes = 0;
    99             Object elem = null;
    97             Object elem = null;
   100             int index;
    98             int index;
   101             for (index = ndefsList.size()-1; index >= 0; index--) {
    99             for (index = ndefsList.size()-1; index >= 0; index--) {
   330         int len=0;
   328         int len=0;
   331         int unused = 0;
   329         int unused = 0;
   332 
   330 
   333         // parse and set up the vectors of all the indefinite-lengths
   331         // parse and set up the vectors of all the indefinite-lengths
   334         while (dataPos < dataSize) {
   332         while (dataPos < dataSize) {
       
   333             if (dataPos + 2 > dataSize) {
       
   334                 // There should be at least one tag and one length
       
   335                 return null;
       
   336             }
   335             parseTag();
   337             parseTag();
   336             len = parseLength();
   338             len = parseLength();
   337             if (len < 0) {
   339             if (len < 0) {
   338                 return null;
   340                 return null;
   339             }
   341             }