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

CF_GetClipboard may crash in Lua, if buf_sz=20000000000000 #1365

Closed
mespotine opened this issue May 30, 2020 · 2 comments · Fixed by #1367
Closed

CF_GetClipboard may crash in Lua, if buf_sz=20000000000000 #1365

mespotine opened this issue May 30, 2020 · 2 comments · Fixed by #1367
Assignees
Labels

Comments

@mespotine
Copy link

The following call of CF_GetClipboard causes problems in Reaper:

A,B = reaper.CF_GetClipboard("",20000000000000)

This either crashes Reaper completely or freezes the Lua-instance of the script. Means, if I try to run the script, it will not run until I restart Reaper.
Maybe some sanity checks would be a good idea.

@cfillion cfillion self-assigned this May 30, 2020
@cfillion
Copy link
Collaborator

cfillion commented May 30, 2020

There's a check but it only guards against large positive numbers. 20000000000000, as a signed 32-bit integer, is -1662697472 which slips right through it. Thanks, fixing!

cfillion added a commit to cfillion/sws that referenced this issue May 31, 2020
@cfillion
Copy link
Collaborator

cfillion commented May 31, 2020

It turns out it's the change that allowed omitting the buf/buf_sz parameters that is letting this happen (the buffer fails to be resized to fit the clipboard data).

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

Successfully merging a pull request may close this issue.

2 participants