Skip to content

CABI: fix realloc alignment in string conversion - #734

Open
lukewagner wants to merge 1 commit into
mainfrom
fix-align
Open

lukewagner wants to merge 1 commit into
mainfrom
fix-align

Conversation

@lukewagner

Copy link
Copy Markdown
Member

As reported in #733, after #54, there's still a case where string reallocation (of a latin1+utf16 string) still specifies the wrong alignment passed to the realloc function. In addition to fixing this, this PR also factors out the alignment and bounds traps which #680 now makes possible.

vados-cosmonic added a commit to vados-cosmonic/jco that referenced this pull request Sep 30, 2026
Implement the remaining string transcoders used by fused adapters,
except for the utf16 copier:

- Copy(Latin1)
- Latin1ToUtf16
- Latin1ToUtf8
- Utf8ToLatin1
- Utf8ToCompactUtf16
- Utf16ToLatin1
- Utf16ToCompactUtf16
- Utf16ToCompactProbablyUtf16

The transcoders rely on latin1+utf16 destinations always being allocated
with an alignment of 2 (see WebAssembly/component-model#734), which the
adapter module already enforces after every realloc.
vados-cosmonic added a commit to vados-cosmonic/jco that referenced this pull request Sep 30, 2026
Implement the remaining string transcoders used by fused adapters,
except for the utf16 copier:

- Copy(Latin1)
- Latin1ToUtf16
- Latin1ToUtf8
- Utf8ToLatin1
- Utf8ToCompactUtf16
- Utf16ToLatin1
- Utf16ToCompactUtf16
- Utf16ToCompactProbablyUtf16

The transcoders rely on latin1+utf16 destinations always being allocated
with an alignment of 2 (see WebAssembly/component-model#734), which the
adapter module already enforces after every realloc.
vados-cosmonic added a commit to vados-cosmonic/jco that referenced this pull request Sep 30, 2026
Implement the remaining string transcoders used by fused adapters,
except for the utf16 copier:

- Copy(Latin1)
- Latin1ToUtf16
- Latin1ToUtf8
- Utf8ToLatin1
- Utf8ToCompactUtf16
- Utf16ToLatin1
- Utf16ToCompactUtf16
- Utf16ToCompactProbablyUtf16

The transcoders rely on latin1+utf16 destinations always being allocated
with an alignment of 2 (see WebAssembly/component-model#734), which the
adapter module already enforces after every realloc.
vados-cosmonic added a commit to vados-cosmonic/jco that referenced this pull request Sep 30, 2026
Implement the remaining string transcoders used by fused adapters,
except for the utf16 copier:

- Copy(Latin1)
- Latin1ToUtf16
- Latin1ToUtf8
- Utf8ToLatin1
- Utf8ToCompactUtf16
- Utf16ToLatin1
- Utf16ToCompactUtf16
- Utf16ToCompactProbablyUtf16

The transcoders rely on latin1+utf16 destinations always being allocated
with an alignment of 2 (see WebAssembly/component-model#734), which the
adapter module already enforces after every realloc.
vados-cosmonic added a commit to vados-cosmonic/jco that referenced this pull request Sep 30, 2026
Implement the remaining string transcoders used by fused adapters,
except for the utf16 copier:

- Copy(Latin1)
- Latin1ToUtf16
- Latin1ToUtf8
- Utf8ToLatin1
- Utf8ToCompactUtf16
- Utf16ToLatin1
- Utf16ToCompactUtf16
- Utf16ToCompactProbablyUtf16

The transcoders rely on latin1+utf16 destinations always being allocated
with an alignment of 2 (see WebAssembly/component-model#734), which the
adapter module already enforces after every realloc.
vados-cosmonic added a commit to vados-cosmonic/jco that referenced this pull request Sep 30, 2026
Implement the remaining string transcoders used by fused adapters,
except for the utf16 copier:

- Copy(Latin1)
- Latin1ToUtf16
- Latin1ToUtf8
- Utf8ToLatin1
- Utf8ToCompactUtf16
- Utf16ToLatin1
- Utf16ToCompactUtf16
- Utf16ToCompactProbablyUtf16

The transcoders rely on latin1+utf16 destinations always being allocated
with an alignment of 2 (see WebAssembly/component-model#734), which the
adapter module already enforces after every realloc.
vados-cosmonic added a commit to vados-cosmonic/jco that referenced this pull request Oct 1, 2026
Implement the remaining string transcoders used by fused adapters,
except for the utf16 copier:

- Copy(Latin1)
- Latin1ToUtf16
- Latin1ToUtf8
- Utf8ToLatin1
- Utf8ToCompactUtf16
- Utf16ToLatin1
- Utf16ToCompactUtf16
- Utf16ToCompactProbablyUtf16

The transcoders rely on latin1+utf16 destinations always being allocated
with an alignment of 2 (see WebAssembly/component-model#734), which the
adapter module already enforces after every realloc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant