[PR #1104] [MERGED] Java wrapper Encoder wrong length #1653

Closed
opened 2026-01-29 20:55:10 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/google/brotli/pull/1104
Author: @hyperxpro
Created: 12/28/2023
Status: Merged
Merged: 1/3/2024
Merged by: @copybara-service[bot]

Base: masterHead: encode-fix


📝 Commits (2)

  • 428d056 Fix Encoder bug
  • 79a5e80 Merge branch 'master' into encode-fix

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 java/org/brotli/wrapper/enc/Encoder.java (+1 -1)

📄 Description

Problem:

Currently, the Java wrapper Encoder is passing byte array length for finishing the encoding of data. This is ideal when the encoder is used with offset 0 and full length is passed but for cases where offset is passed and length is also specified, it leads to encoded data corruption.

Changes:
Instead of passing byte array length to the push method, we will now pass length directly.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/google/brotli/pull/1104 **Author:** [@hyperxpro](https://github.com/hyperxpro) **Created:** 12/28/2023 **Status:** ✅ Merged **Merged:** 1/3/2024 **Merged by:** [@copybara-service[bot]](https://github.com/apps/copybara-service) **Base:** `master` ← **Head:** `encode-fix` --- ### 📝 Commits (2) - [`428d056`](https://github.com/google/brotli/commit/428d056ddcf2e1bb7f170a5f0a403763ecda7d1d) Fix Encoder bug - [`79a5e80`](https://github.com/google/brotli/commit/79a5e80a598f7c5162e10569e35c2c9d1d12422f) Merge branch 'master' into encode-fix ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `java/org/brotli/wrapper/enc/Encoder.java` (+1 -1) </details> ### 📄 Description Problem: Currently, the Java wrapper Encoder is passing byte array length for finishing the encoding of data. This is ideal when the encoder is used with offset 0 and full length is passed but for cases where offset is passed and length is also specified, it leads to encoded data corruption. Changes: Instead of passing byte array length to the `push` method, we will now pass `length` directly. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 20:55:10 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/brotli#1653