Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

portability: memcpy of size zero is undefined behaviour #7

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

trufae
Copy link

@trufae trufae commented Jan 1, 2023

No description provided.

Copy link
Member

@oleavr oleavr left a comment

Choose a reason for hiding this comment

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

Thanks!

quickjs.c Outdated Show resolved Hide resolved
Comment on lines +32781 to +32782
memcpy(b->vardefs, fd->args, fd->arg_count * sizeof(fd->args[0]));
memcpy(b->vardefs + fd->arg_count, fd->vars, fd->var_count * sizeof(fd->vars[0]));
Copy link
Member

@oleavr oleavr Apr 26, 2023

Choose a reason for hiding this comment

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

It looks like this will cause a regression: if only one of the two is empty, the other one won't be copied. Shouldn't we have one if per memcpy()?

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.

3 participants