diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2024-09-07 15:52:04 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2024-09-07 15:56:25 -0700 |
commit | 8801053fc2c5b482d993593c97949b8ac029c65c (patch) | |
tree | 84bf16b004e23eb98bbce52e08af8efd9671f698 /src | |
parent | 497ecae46a8ee31122edad3984e1187ed9cc370c (diff) |
vcr: more row overflow crash preventions
There's still assumptions that everything in the hierarchy fits
within the canvas... the Xlib stuff would clip all this behind
the scenes, but vcr/headless mode doesn't have such guard rails.
At some point I need to sit down and do a thorough pass in this
vein... Fortunately most my headless use cases have the canvas
configured appropriately.
Diffstat (limited to 'src')
-rw-r--r-- | src/vcr.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -1124,6 +1124,9 @@ void vcr_mark_finish_line(vcr_t *vcr, vcr_layer_t layer, int row) /* FIXME: the layers in backend/vcr etc should be in a layer-indexable array */ assert(layer == VCR_LAYER_GRAPHA || layer == VCR_LAYER_GRAPHB); + if (row * VCR_ROW_HEIGHT >= vcr->height) + return; + switch (vcr->backend->type) { #ifdef USE_XLIB case VCR_BACKEND_TYPE_XLIB: { @@ -1555,6 +1558,9 @@ void vcr_stash_row(vcr_t *vcr, vcr_layer_t layer, int row) assert(layer == VCR_LAYER_GRAPHA || layer == VCR_LAYER_GRAPHB); /* for now we only support stashing graphs */ + if (row * VCR_ROW_HEIGHT >= vcr->height) + return; + switch (vcr->backend->type) { #ifdef USE_XLIB case VCR_BACKEND_TYPE_XLIB: { @@ -1610,6 +1616,9 @@ void vcr_unstash_row(vcr_t *vcr, vcr_layer_t layer, int row) assert(vcr->backend); assert(layer == VCR_LAYER_GRAPHA || layer == VCR_LAYER_GRAPHB); + if (row * VCR_ROW_HEIGHT >= vcr->height) + return; + switch (vcr->backend->type) { #ifdef USE_XLIB case VCR_BACKEND_TYPE_XLIB: { |