diff options
Diffstat (limited to 'xwayland/selection.c')
-rw-r--r-- | xwayland/selection.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/xwayland/selection.c b/xwayland/selection.c index 0d7f1588..280df583 100644 --- a/xwayland/selection.c +++ b/xwayland/selection.c @@ -55,6 +55,15 @@ static int xwm_read_data_source(int fd, uint32_t mask, void *data) { int current = selection->source_data.size; if (selection->source_data.size < incr_chunk_size) { p = wl_array_add(&selection->source_data, incr_chunk_size); + if (!p){ + wlr_log(L_ERROR, "Could not allocate selection source_data to read into, throwing away some input"); + /* if we just return now, we'll just be called + * again right away - force read something. + * 1K on stack is probably fine? */ + char junk[1024]; + read(fd, junk, sizeof(junk)); + return 1; + } } else { p = (char *) selection->source_data.data + selection->source_data.size; } |