Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add comment
  • Loading branch information
xerial committed Feb 15, 2021
commit a04ddb530068a2da6eb740e8e8218bd978a0e3a8
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ package org.msgpack.core
class InvalidDataReadTest extends MessagePackSpec {

"Reading long EXT32" in {
// Prepare an EXT32 data with 2GB (Int.MaxValue size) payload for testing the behavior of MessageUnpacker.skipValue()
// Actually preparing 2GB of data, however, is too much for CI, so we create only the header part.
val msgpack = createMessagePackData(p => p.packExtensionTypeHeader(MessagePack.Code.EXT32, Int.MaxValue))
val u = MessagePack.newDefaultUnpacker(msgpack)
try {
// This error will be thrown after reading the header as the input has no EXT32 body
intercept[MessageInsufficientBufferException] {

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.

The expectation of this test case is unclear to me. I guess you want to avoid 2GB memory allocation in this test, though. How about adding a comment to describe your intention?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Added more comment to explain why we need to use this a bit weird test code

u.skipValue()
}
Expand Down