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
|
@Override
|
||||||
public final void checkReadLimit(int numBytes) {
|
public final void checkReadLimit(int numWords) {
|
||||||
if (numBytes > limit) {
|
if (limit == -1) {
|
||||||
|
return;
|
||||||
|
} else if (numWords > limit) {
|
||||||
throw new DecodeException("Read limit exceeded.");
|
throw new DecodeException("Read limit exceeded.");
|
||||||
} else {
|
} else {
|
||||||
limit -= numBytes;
|
limit -= numWords;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,7 +145,7 @@ public final class Serialize {
|
||||||
}
|
}
|
||||||
bb.position(segmentBase + totalWords * Constants.BYTES_PER_WORD);
|
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.");
|
throw new DecodeException("Message size exceeds traversal limit.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue