Permalink
Browse files

allow constructed sequence to be empty

encountered sequence that has 0 length which is still valid
  • Loading branch information...
1 parent d737f7d commit 12e715d13dec92850ec6742bf1745ae0cd493482 @odrobnik odrobnik committed Mar 10, 2013
Showing with 6 additions and 12 deletions.
  1. +6 −12 Core/Source/DTASN1Parser.m
View
@@ -381,9 +381,6 @@ - (BOOL)_parseRange:(NSRange)range
[_data getBytes:&tagByte range:NSMakeRange(location, 1)];
location++;
- // BOOL isSeq = tagByte & 32;
- // BOOL isContext = tagByte & 128;
-
NSUInteger tagClass = tagByte >> 6;
DTASN1Type tagType = tagByte & 31;
BOOL tagConstructed = (tagByte >> 5) & 1;
@@ -429,21 +426,18 @@ - (BOOL)_parseRange:(NSRange)range
if (tagConstructed)
{
- // constructed element
- if (subRange.length == 0)
- {
- return NO;
- }
-
-
if (_delegateFlags.delegateSupportsContainerStart)
{
[_delegate parser:self didStartContainerWithType:tagType];
}
- if (![self _parseRange:subRange])
+ // allow for sequence without content
+ if (subRange.length > 0)
{
- _abortParsing = YES;
+ if (![self _parseRange:subRange])
+ {
+ _abortParsing = YES;
+ }
}
if (_delegateFlags.delegateSupportsContainerEnd)

0 comments on commit 12e715d

Please sign in to comment.