Skip to content

6l: fix datblk loop in asmb_elf: sizeof(buf) not sizeof(buf.dbuf)#141

Merged
staalmannen merged 1 commit into
mainfrom
claude/upgrade-ape-c-library-mmZGd
May 22, 2026
Merged

6l: fix datblk loop in asmb_elf: sizeof(buf) not sizeof(buf.dbuf)#141
staalmannen merged 1 commit into
mainfrom
claude/upgrade-ape-c-library-mmZGd

Conversation

@staalmannen

Copy link
Copy Markdown
Owner

buf.dbuf is char[1], so sizeof(buf.dbuf)=1. With Dbufslop=100 the step was 1-100=-99, which got passed as the write count to pwrite, causing "bad address in syscall". The correct size is sizeof(buf) (the full union), matching the existing asmb() data loop.

https://claude.ai/code/session_01WGAwvvTwDg2yknFkmZ3qzs

buf.dbuf is char[1], so sizeof(buf.dbuf)=1. With Dbufslop=100 the
step was 1-100=-99, which got passed as the write count to pwrite,
causing "bad address in syscall". The correct size is sizeof(buf)
(the full union), matching the existing asmb() data loop.

https://claude.ai/code/session_01WGAwvvTwDg2yknFkmZ3qzs
@staalmannen staalmannen merged commit af2423d into main May 22, 2026
1 check passed

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the asmb_elf function in sys/src/cmd/6l/asm.c to use sizeof(buf) instead of sizeof(buf.dbuf) for buffer size calculations during data block processing. I have no feedback to provide as there are no review comments.

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.

2 participants