Legacy bs_put_utf8/16/32 raise unsupported at a non-byte-aligned offset

オープン 初心者向け
#2,444 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

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

評価

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

調査の方向性

opcodesswitch.h の OP_BS_PUT_UTF8、OP_BS_PUT_UTF16、OP_BS_PUT_UTF32 を、bitstring_insert_utf8/16/32 ヘルパーおよび #2357 の変更とあわせて読む。erlc +no_bs_create_bin +no_bs_match +no_type_opt でコンパイルしたコードを使って再現し、インタープリター上で実行する。レガシーオペコードがバイト境界に揃っていないオフセットを受け入れ、例が示されたビットストリングを生成すれば完了。

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

説明

With the legacy construction opcodes (code compiled by OTP 24 or older, or with +no_bs_create_bin), a utf8, utf16 or utf32 segment that does not start on a byte boundary raises unsupported:

C = id($a),
<<1:1, C/utf8>>          %% OTP 27 <<176,1:1>>          AtomVM unsupported
<<1:1, C/utf16>>         %% OTP 27 <<128,48,1:1>>       AtomVM unsupported
<<1:1, C/utf32>>         %% OTP 27 <<128,0,0,48,1:1>>   AtomVM unsupported
<<C/utf8, 1:1, C/utf8>>  %% OTP 27 <<97,176,1:1>>       AtomVM unsupported

Compiled with OTP 27 erlc +no_bs_create_bin +no_bs_match +no_type_opt and run on the interpreter (the JIT compiler does not accept these opcodes).

Cause: OP_BS_PUT_UTF8, OP_BS_PUT_UTF16 and OP_BS_PUT_UTF32 in opcodesswitch.h still reject ctx->bs_offset % 8 != 0 before calling bitstring_insert_utf8/16/32. With #2357 those helpers write at any bit offset (bs_create_bin already uses them that way), so the three checks can be removed once #2357 is merged.

主要言語
Erlang
スター
2.3k
フォーク
171
平均マージ
5日 11時間
マージ済み PR(30日)
19

環境構築

はじめの一歩

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

atomvm/AtomVM のほかの issue

atomvm/AtomVM の issue をすべて見る

似ている issue

Backend & API Design の issue をもっと見る

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

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