Legacy bs_put_utf8/16/32 raise unsupported at a non-byte-aligned offset
Maintainers usually reply within 3 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
Research direction
Read OP_BS_PUT_UTF8, OP_BS_PUT_UTF16 and OP_BS_PUT_UTF32 in opcodesswitch.h, along with the bitstring_insert_utf8/16/32 helpers and the change in #2357. Reproduce using code compiled with erlc +no_bs_create_bin +no_bs_match +no_type_opt and run it on the interpreter. Done when the legacy opcodes accept non-byte-aligned offsets and the examples produce the shown bitstrings.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- Erlang
- Stars
- 2.3k
- Forks
- 171
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 20
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from atomvm/AtomVM
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 3 days
-
lwIP sockets: a failed listen or connect leaves the socket lock held, a later close hangs foreverOpen
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 3 days
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
milind-soni/OpenMausBot#5829 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
finos/fluxnova-bpm-platform#387 ·
Maintainers usually reply within 4 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
OHDSI/Data2Evidence#3693 ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Project-N-E-K-O/N.E.K.O#3725 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
kubernetes-sigs/headlamp#8408 ·
Maintainers usually reply within 1 day