File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed
main/java/org/msgpack/core
test/scala/org/msgpack/core Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -964,11 +964,12 @@ public String unpackString() throws IOException {
964964 int cursor = 0 ;
965965 decodeBuffer .clear ();
966966 StringBuilder sb = new StringBuilder ();
967+
967968 while (cursor < strLen ) {
968- if (!ensure (strLen -cursor ))
969+ int readLen = Math .min (position < buffer .size () ? buffer .size () - position : buffer .size (), strLen -cursor );
970+ if (!ensure (readLen ))
969971 throw new EOFException ();
970972
971- int readLen = Math .min (buffer .size () - position , strLen -cursor );
972973 ByteBuffer bb = buffer .toByteBuffer (position , readLen );
973974
974975 while (bb .hasRemaining ()) {
Original file line number Diff line number Diff line change @@ -619,7 +619,7 @@ class MessageUnpackerTest extends MessagePackSpec {
619619 u.close
620620 }
621621
622- " parse message large packed data" taggedAs(" unpack " ) in {
622+ " unpack large string data" taggedAs(" large-string " ) in {
623623 def createLargeData (stringLength : Int ): Array [Byte ] = {
624624 val out = new ByteArrayOutputStream ()
625625 val packer = msgpack.newPacker(out)
You can’t perform that action at this time.
0 commit comments