Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Binary decoder returns incorrect data after short stream reads

クローズ
#56 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

  • #57 @sylvesterkaczmarek による — マージされずにクローズ

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
76/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
java
領域
backend

調査の方向性

BaseBinaryInputReader.checkBuffer() から開始し、提供された FixedBinaryDecoder と分割された ByteArrayInputStream の例で問題を再現します。バイト配列入力に対する directGetBytes() と MALException の処理を追跡します。分割された読み取りで要求されたバイトが蓄積され、不十分なストリームまたはバッファーが MALException をスローし、整数、文字列、バイトブロックに誤ったデータやパディングされたデータが含まれなくなれば完了です。

索引モデルが issue の本文から書いたものです。

説明

On master 028751ad, BaseBinaryInputReader.checkBuffer() performs only one stream read before allowing decoding. A valid short read leaves part of the requested value unfilled, so the decoder can silently return incorrect data.

InputStream input = new ByteArrayInputStream(new byte[]{1, 35, 69, 103}) {
    @Override
    public synchronized int read(byte[] buffer, int offset, int length) {
        return super.read(buffer, offset, Math.min(length, 1));
    }
};
new FixedBinaryDecoder(input, null, false).decodeInteger();

Expected: 0x01234567 (19088743). Actual: 0x01000000 (16777216).

Strings and byte blocks also contain incorrect bytes after fragmented reads. With byte-array input, checkBuffer() does not verify the readable length, so directGetBytes() can silently pad truncated input with zeros or decode unused buffer capacity.

The reader should accumulate enough bytes before decoding and throw MALException when the stream or buffer cannot satisfy the requested length.

主要言語
Java
スター
18
フォーク
11
平均マージ
4分
マージ済み PR(30日)
1

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

esa/mo-services-java のほかの issue

esa/mo-services-java の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。