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

Sway does not compile #3862

Closed
johnae opened this issue Mar 11, 2019 · 3 comments
Closed

Sway does not compile #3862

johnae opened this issue Mar 11, 2019 · 3 comments

Comments

@johnae
Copy link
Contributor

johnae commented Mar 11, 2019

After this 5c8424c#diff-9ae010cb99f0a17a044ce6772d0e7ebc sway does not compile, compilation fails with error:

In function 'log_loaded_themes.isra.1',
    inlined from 'init_themes' at ../swaybar/tray/icon.c:351:2:
../swaybar/tray/icon.c:319:8: error: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Werror=alloc-size-larger-than=]
  char *str = malloc(len);
@emersion
Copy link
Member

Damn, that's a pretty bad bug. Working on a fix.

emersion added a commit to emersion/sway that referenced this issue Mar 11, 2019
`len` will underflow but will overflow right after, so it's not as bad as it
may appear. Still better not to under/overflow at all.

Fixes swaywm#3862
@ianyfan
Copy link
Contributor

ianyfan commented Mar 11, 2019

Hmm, this seems to imply that len == -1 (which becomes enormous due to being unsigned) but that can only ever happen if themes->length == 0 which is checked for at the beginning of the function.

Maybe it is an optimisation issue?

A fix could be to make len a ssize_t.

@emersion
Copy link
Member

Can you try #3864?

RedSoxFan pushed a commit that referenced this issue Mar 11, 2019
`len` will underflow but will overflow right after, so it's not as bad as it
may appear. Still better not to under/overflow at all.

Fixes #3862
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants