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

0x22 in unsigned char arrays #50

Open
smf- opened this issue Dec 26, 2024 · 0 comments
Open

0x22 in unsigned char arrays #50

smf- opened this issue Dec 26, 2024 · 0 comments

Comments

@smf-
Copy link

smf- commented Dec 26, 2024

putting 0x22 into an unsigned char array is causing me a problem

compiling this with -S

static unsigned char works[] = {0x01, 0x02, 0x03};
static unsigned char fails[] = {0x21, 0x22, 0x23};

volatile unsigned char *o = (volatile unsigned char *)0;

int main(int argc, char *argv[])
{
	for (int i = 0; i < 3; i++)
	{
		*o = works[i];
		*o = fails[i];
	}
}

gives:

	section	.data,"aw",@progbits
	private	_works
_works:
	db	"���"

	section	.data,"aw",@progbits
	private	_fails
_fails:
	db	"!""#"

Which I think might be malformed.

Using the x64 version of clang gives something more like I would expect, but I'm not sure if the output is what you expect and there is an issue elsewhere?

works:                                  # @works
	.ascii	"\001\002\003"

fails:                                  # @fails
	.ascii	"!\"#"

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

No branches or pull requests

1 participant