summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2025-08-16 08:13:53 -0700
committerVito Caputo <vcaputo@pengaru.com>2025-08-16 08:13:53 -0700
commit281865fde4591c28b23afb006841ca6ece736b74 (patch)
tree146850810bd71fd3c8065ba512c8b0383f08a231 /src
parent692a052c6303cfbd9daecbcec99c54441f6b3af2 (diff)
modules/flow/flow: fix edge case segfault
When flow became threaded this bug was introduced. It's possible for the unchecked put_pixel to go out of bounds while stepping through n_iters, since the bounds check bypassing this doesn't consider the full range of the iterated coordinates. A simple fix to prevent the segfault is to use the checked variant.
Diffstat (limited to 'src')
-rw-r--r--src/modules/flow/flow.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/modules/flow/flow.c b/src/modules/flow/flow.c
index c9b94e4..901eda8 100644
--- a/src/modules/flow/flow.c
+++ b/src/modules/flow/flow.c
@@ -295,6 +295,8 @@ static void flow_render_fragment(til_module_context_t *context, til_stream_t *st
/* for cases obviously outside the fragment, don't draw anything */
+ /* FIXME: these early-outs don't consider the ctxt->n_iters interpolated coordinates */
+
/* totally outside (above) */
if (y1 < fy1 && y2 < fy1)
continue;
@@ -331,7 +333,8 @@ static void flow_render_fragment(til_module_context_t *context, til_stream_t *st
x1 = pos.x / (pos.z + ZCONST) * ffw + (ffw >> 1);
y1 = pos.y / (pos.z + ZCONST) * ffh + (ffh >> 1);
- (void) til_fb_fragment_put_pixel_unchecked(fragment, TIL_FB_DRAW_FLAG_TEXTURABLE, x1, y1, pixel);
+ /* XXX: now that [xy]1 are changed, unchecked can't be used, it could be done more cleverly */
+ (void) til_fb_fragment_put_pixel_checked(fragment, TIL_FB_DRAW_FLAG_TEXTURABLE, x1, y1, pixel);
}
continue;
© All Rights Reserved