Do not allocate when a Kitty payload chunk decodes to no bytes.

This commit is contained in:
Michael Grant
2026-10-09 22:50:02 +02:00
parent 4b13e0c3d7
commit e29f9f7076
2 changed files with 12 additions and 0 deletions

View File

@@ -952,6 +952,12 @@ kitty_append(struct kitty_state *ks, const u_char *buf, size_t len)
free(copy);
if (decoded == NULL)
return (-1);
/* Empty decoded chunks need no allocation. */
if (decodedlen == 0) {
free(decoded);
return (0);
}
if (decodedlen > IMAGE_SIZE_LIMIT - ks->rawlen) {
free(decoded);
return (-1);