am 7b5f2b71: Fix Ver4DictDecoder.readAndFollowForwardLink().

* commit '7b5f2b71f5ce8af82b4c0faad38437bca750cffe':
  Fix Ver4DictDecoder.readAndFollowForwardLink().
main
Yuichiro Hanada 2013-10-16 01:41:27 -07:00 committed by Android Git Automerger
commit 2e8536e962
1 changed files with 7 additions and 4 deletions

View File

@ -319,10 +319,13 @@ public class Ver4DictDecoder extends AbstractDictDecoder {
@Override
public boolean readAndFollowForwardLink() {
final int forwardLinkPos = mDictBuffer.position();
final int nextAddress = forwardLinkPos + BinaryDictDecoderUtils.readSInt24(mDictBuffer);
if (nextAddress >= 0 && nextAddress < mDictBuffer.limit()) {
mDictBuffer.position(nextAddress);
return true;
int nextRelativePos = BinaryDictDecoderUtils.readSInt24(mDictBuffer);
if (nextRelativePos != FormatSpec.NO_FORWARD_LINK_ADDRESS) {
final int nextPos = forwardLinkPos + nextRelativePos;
if (nextPos >= 0 && nextPos < mDictBuffer.limit()) {
mDictBuffer.position(nextPos);
return true;
}
}
return false;
}