GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix ByteBuffer copy offsets for sliced and read-only buffers by PHJ2000 · Pull Request #1037 · msgpack/msgpack-java

Conversation

@PHJ2000

@PHJ2000 PHJ2000 commented Oct 22, 2026

Copy link
Copy Markdown

Fixes #1036.

MessageBuffer.putByteBuffer can copy the wrong bytes from a sliced heap source, overwrite bytes before a sliced heap destination when reading a read-only source, or repeatedly overwrite the first destination byte when copying a read-only heap source into direct storage.

Include the source/destination array offsets and advance the direct destination address for each byte. Add a 64-case regression matrix across heap/direct storage, read-only sources, source/destination slices, and empty/partial copies. The assertions also cover untouched destination bytes and source position, limit, and mark. Ten cases fail before the fix; all pass afterward with both the default and universal buffer implementations.

Validation:

  • OpenJDK 21: ./sbt -batch scalafmtCheckAll jcheckStyle and ./sbt -batch 'msgpack-core/testFull' passed (257 tests, 1 existing pending test).
  • Java 8: the same 257 core tests passed with TEST_JAVA_HOME set to the Java 8 installation and the session setting set msgpackCore / javacOptions ++= Seq("-bootclasspath", "<jdk8>/jre/lib/rt.jar"). Without this setting, the build reused production classes linked against Java 9+ covariant NIO methods and failed with NoSuchMethodError on Java 8.
  • Universal mode (JAVA_TOOL_OPTIONS=-Dmsgpack.universal-buffer=true): all 64 new cases passed. The full core suite had one existing DirectBufferAccessTest initialization error because MessageBuffer.unsafe is null; an isolated initialization probe fails identically against the original and patched classes.
  • The sbt build did not discover the Jackson JUnit tests. Running them explicitly with JUnit Platform 1.14.4 found 77 tests, with 50 passing and 27 fixture-initialization failures. The exact same 27 failures occur with the original MessageBuffer class: the shared fixture uses JUnit 4 lifecycle annotations while the affected tests use Jupiter annotations.

No build settings or unrelated test fixtures are changed in this PR.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@PHJ2000
Fix ByteBuffer copy offsets for sliced and read-only buffers
6e11243
Signed-off-by: Jaehong Park <[email protected]>
@github-actions github-actions Bot added the bug label Oct 22, 2026
@PHJ2000 PHJ2000 mentioned this pull request Nov 6, 2026
Fix map size overflow in unpackValue #1044
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

bug

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

MessageBuffer.putByteBuffer corrupts copies from sliced or read-only heap buffers

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@PHJ2000
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.