From b06073f7716373b115b4e039193ce622dbccb3a5 Mon Sep 17 00:00:00 2001 From: Christian Soffke Date: Wed, 10 Apr 2024 20:51:34 +0200 Subject: buffering: ensure sufficient buffer size loading bitmaps Commits 5aa0fc3 and 32f1418 (g#4451, g#4452) changed the amount of space that was allocated for loading bitmaps used to display album art. Testing revealed that the size of the JPEG decode buffer can reach up to (38 * 1024)B in some cases. When the limit is reached, additional space is required by the resize_on_load function. Change-Id: If93b45754a4f5948b6160f659182e4618e01912e --- apps/buffering.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'apps/buffering.c') diff --git a/apps/buffering.c b/apps/buffering.c index 81b861ccf1..bf41544c56 100644 --- a/apps/buffering.c +++ b/apps/buffering.c @@ -975,8 +975,14 @@ int bufopen(const char *file, off_t offset, enum data_type type, * TODO: don't add unncessary overhead for .bmp images! */ size += JPEG_DECODE_OVERHEAD; #endif - } + /* resize_on_load requires space for 1 line + 2 spare lines */ +#ifdef HAVE_LCD_COLOR + size += sizeof(struct uint32_argb) * 3 * aa->dim->width; +#else + size += sizeof(uint32_t) * 3 * aa->dim->width; #endif + } +#endif /* HAVE_ALBUMART */ if (size == 0) size = filesize(fd); -- cgit v1.2.3