From 8af77675624a7dc2d8471f57512eef58d2563bbf Mon Sep 17 00:00:00 2001 From: justwolf Date: Thu, 7 Mar 2024 03:04:51 +0000 Subject: [PATCH] sixel: Handle NULL pointer When reading /dev/urandom, sixel_add_ar_11() gets triggered, which didn't properly handle the possibility of a NULL pointer, causing the program to segfault. --- sixel.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sixel.c b/sixel.c index 3e13af23..0a01e8b7 100644 --- a/sixel.c +++ b/sixel.c @@ -1492,6 +1492,8 @@ sixel_add_ar_11(struct terminal *term, uint32_t *data, int stride, uint32_t colo xassert(term->sixel.pos.row < term->sixel.image.height); xassert(term->sixel.pan == 1); + if (data == NULL) + return; if (sixel & 0x01) *data = color; data += stride;