Return early if image is zero height when generating fallback, otherwise we can

allocated too little space. Reported by Vivek Parikh.
This commit is contained in:
Nicholas Marriott
2026-08-24 15:27:25 +01:00
parent f763f94556
commit 41e701ad84

View File

@@ -84,6 +84,11 @@ image_fallback(char **ret, u_int sx, u_int sy)
char *buf, *label;
u_int py, size, lsize;
if (sy == 0) {
*ret = xstrdup("");
return;
}
/* Allocate first line. */
lsize = xasprintf(&label, "SIXEL IMAGE (%ux%u)\r\n", sx, sy) + 1;
if (sx < lsize - 3)