Stream: git-wasmtime

Topic: wasmtime / PR #2620 Fix `fd_readdir` to properly truncate...


view this post on Zulip Wasmtime GitHub notifications bot (Jan 28 2021 at 20:45):

peterhuene opened PR #2620 from fix-fd-readdir to main:

Previously, fd_readdir was truncating directory entry names based on the
calculation of min(name_len, buf_len - bufused), but bufused was not being
updated after writing in the dirent structure to the buffer.

This allowed bufused to be incremented beyond buf_len and returned as the
number of bytes written to the buffer, which is invalid.

This fix adjusts bufused when the buffer is written to for the dirent so
that name truncation happens as expected.

Fixes #2618.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 28 2021 at 20:45):

peterhuene requested sunfishcode for a review on PR #2620.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 28 2021 at 20:48):

peterhuene updated PR #2620 from fix-fd-readdir to main:

Previously, fd_readdir was truncating directory entry names based on the
calculation of min(name_len, buf_len - bufused), but bufused was not being
updated after writing in the dirent structure to the buffer.

This allowed bufused to be incremented beyond buf_len and returned as the
number of bytes written to the buffer, which is invalid.

This fix adjusts bufused when the buffer is written to for the dirent so
that name truncation happens as expected.

Fixes #2618.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 28 2021 at 22:33):

peterhuene updated PR #2620 from fix-fd-readdir to main:

Previously, fd_readdir was truncating directory entry names based on the
calculation of min(name_len, buf_len - bufused), but bufused was not being
updated after writing in the dirent structure to the buffer.

This allowed bufused to be incremented beyond buf_len and returned as the
number of bytes written to the buffer, which is invalid.

This fix adjusts bufused when the buffer is written to for the dirent so
that name truncation happens as expected.

Fixes #2618.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 28 2021 at 22:42):

peterhuene updated PR #2620 from fix-fd-readdir to main:

Previously, fd_readdir was truncating directory entry names based on the
calculation of min(name_len, buf_len - bufused), but bufused was not being
updated after writing in the dirent structure to the buffer.

This allowed bufused to be incremented beyond buf_len and returned as the
number of bytes written to the buffer, which is invalid.

This fix adjusts bufused when the buffer is written to for the dirent so
that name truncation happens as expected.

Fixes #2618.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 01 2021 at 19:06):

pchickey submitted PR Review.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 01 2021 at 19:06):

pchickey created PR Review Comment:

the buf.add(dirent_copy_len)? performs this overflow check, so bufused doesnt have to have a checked add

view this post on Zulip Wasmtime GitHub notifications bot (Feb 01 2021 at 19:07):

pchickey submitted PR Review.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 01 2021 at 19:07):

pchickey created PR Review Comment:

same here, no need to check the add

view this post on Zulip Wasmtime GitHub notifications bot (Feb 01 2021 at 19:10):

pchickey submitted PR Review.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 01 2021 at 19:41):

peterhuene updated PR #2620 from fix-fd-readdir to main:

Previously, fd_readdir was truncating directory entry names based on the
calculation of min(name_len, buf_len - bufused), but bufused was not being
updated after writing in the dirent structure to the buffer.

This allowed bufused to be incremented beyond buf_len and returned as the
number of bytes written to the buffer, which is invalid.

This fix adjusts bufused when the buffer is written to for the dirent so
that name truncation happens as expected.

Fixes #2618.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 01 2021 at 20:29):

peterhuene merged PR #2620.


Last updated: Dec 23 2024 at 12:05 UTC