From 13c4c605b34ed1002dac30e9ff6441213d845796 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 28 Sep 2017 13:53:12 +0530 Subject: [PATCH] Prevent loading of too large PNG images --- kitty/graphics.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kitty/graphics.c b/kitty/graphics.c index 81422cc7f..72a1593e5 100644 --- a/kitty/graphics.c +++ b/kitty/graphics.c @@ -284,6 +284,7 @@ handle_add_command(GraphicsManager *self, const GraphicsCommand *g, const uint8_ switch(fmt) { case PNG: if (!g->data_sz) ABRT(EINVAL, "Must provide a data size with the PNG format"); + if (g->data_sz > 4 * 100000000) ABRT(EINVAL, "PNG data size too large"); img->load_data.is_4byte_aligned = true; img->load_data.data_sz = g->data_sz; break;