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

fix segfault on conversion error #117

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

Conversation

rogpeppe
Copy link

When I copy some text from a github commit inside Chrome,
the selection cannot be converted to text.
When I run xclip -o with that selection in the paste buffer,
I get a segmentation fault because free is being called with
an invalid argument (presumably because xcout isn't setting the
sel_buf pointer correctly on error).

% xclip -o
1587474: signal: sys: segmentation violation (core dumped)

To fix this, remove the call to free in the error case, as it isn't really necessary
anyway as the program is about to exit.

When the free call is removed, xclip prints this error instead of seg-faulting:

xclip: Error: 'Chromium clipboard' (0x1c00024) cannot convert PRIMARY selection to target 'STRING'

When I copy some text from a github commit inside Chrome,
the selection cannot be converted to text.
When I run `xclip -o` with that selection in the paste buffer,
I get a segmentation fault because `free` is being called with
an invalid argument (presumably because xcout isn't setting the
`sel_buf` pointer correctly on error).

```
% xclip -o
1587474: signal: sys: segmentation violation (core dumped)
```

To fix this, remove the call to `free` in the error case, as it isn't really necessary
anyway as the program is about to exit.

When the `free` call is removed, `xclip` prints this error instead of seg-faulting:

```
xclip: Error: 'Chromium clipboard' (0x1c00024) cannot convert PRIMARY selection to target 'STRING'
```
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.

1 participant