Skip to content

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

Closed

Description

@mespotine

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.

Activity

  1. self-assigned this
    on May 30, 2020
  2. cfillion commented on May 30, 2020

    @cfillion
    Member

    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!

  3. added a commit that references this issue on May 31, 2020
    459018e
  4. cfillion commented on May 31, 2020

    @cfillion
    Member

    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).

  5. added a commit that references this issue on May 31, 2020
    9e0bbca
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions