Merge pull request #96 from wdu/master
Offer option to disable traversalLimitInWords
This commit is contained in:
commit
854997703d
2 changed files with 6 additions and 4 deletions
|
@ -45,11 +45,13 @@ public final class ReaderArena implements Arena {
|
|||
}
|
||||
|
||||
@Override
|
||||
public final void checkReadLimit(int numBytes) {
|
||||
if (numBytes > limit) {
|
||||
public final void checkReadLimit(int numWords) {
|
||||
if (limit == -1) {
|
||||
return;
|
||||
} else if (numWords > limit) {
|
||||
throw new DecodeException("Read limit exceeded.");
|
||||
} else {
|
||||
limit -= numBytes;
|
||||
limit -= numWords;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@ public final class Serialize {
|
|||
}
|
||||
bb.position(segmentBase + totalWords * Constants.BYTES_PER_WORD);
|
||||
|
||||
if (totalWords > options.traversalLimitInWords) {
|
||||
if (options.traversalLimitInWords != -1 && totalWords > options.traversalLimitInWords) {
|
||||
throw new DecodeException("Message size exceeds traversal limit.");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue