FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix MessageUnpacker#unpackString in case that string length is more than... by komamitsu · Pull Request #215 · msgpack/msgpack-java · GitHub

Fix MessageUnpacker#unpackString in case that string length is more than... - #215

Merged
xerial merged 1 commit into
v07-developfrom
issue_209
Apr 4, 2015
Merged

Fix MessageUnpacker#unpackString in case that string length is more than...#215
xerial merged 1 commit into
v07-developfrom
issue_209

Conversation

Copy link
Copy Markdown
Member

I modified MessageUnpacker#unpackString to fix #209.

@xerial Can you review this change?

xerial commented Apr 4, 2015

Copy link
Copy Markdown
Member

I found another bug; This part should use ensure(strLen-cursor):

    while(cursor < strLen) {
                     if (!ensure(strLen))
                         throw new EOFException();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I think there is no guarantee that the read length from the input always matches Math.min(buffer.size() - position, strLen-cursor) when OVERFLOW (output buffer has insufficient space) happens. When OVERFLOW occurs, the input data might be partially read. That is why I compute readLen as bb.limit() - bb.remaining().

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Ah. I was wrong. readLen can be retrieved by bb.position() since we created a new ByteBuffer at

ByteBuffer bb = buffer.toByteBuffer(position, readLen);

whose initial position is 0.

xerial commented Apr 4, 2015

Copy link
Copy Markdown
Member

Now I got it. I don't need to set readLen in while(bb.hasRamaining()) loop. Thanks

xerial added a commit that referenced this pull request Apr 4, 2015
Fix MessageUnpacker#unpackString in case that string length is more than...
xerial merged commit 7cd8f41 into v07-develop Apr 4, 2015
xerial deleted the issue_209 branch May 28, 2015 14:51
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL