From 866e1d04d5a80207860f6a0b44dfeca33ff2e7e1 Mon Sep 17 00:00:00 2001 From: nick black Date: Wed, 9 Jun 2021 15:23:48 -0400 Subject: [PATCH] termdesc: disable sixel with fewer than 64 color registers up front #1716 --- src/lib/sixel.c | 8 +------- src/lib/termdesc.c | 3 +++ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/lib/sixel.c b/src/lib/sixel.c index e9c5ef63e..c3bd2deb9 100644 --- a/src/lib/sixel.c +++ b/src/lib/sixel.c @@ -743,16 +743,10 @@ sixel_blit_inner(int leny, int lenx, sixeltable* stab, int sixel_blit(ncplane* n, int linesize, const void* data, int leny, int lenx, const blitterargs* bargs, int bpp __attribute__ ((unused))){ int colorregs = bargs->u.pixel.colorregs; - if(colorregs <= 0){ - return -1; - } if(colorregs > 256){ colorregs = 256; } - // FIXME enforce this in discovery, possibly raising the value - if(colorregs < 64){ - return -1; - } + assert(colorregs >= 64); sixeltable stable = { .map = sixelmap_create(colorregs, leny - bargs->begy, lenx - bargs->begx), .deets = malloc(colorregs * sizeof(cdetails)), diff --git a/src/lib/termdesc.c b/src/lib/termdesc.c index f17fa4432..d2c2588b8 100644 --- a/src/lib/termdesc.c +++ b/src/lib/termdesc.c @@ -493,6 +493,9 @@ query_sixel_details(tinfo* ti, int fd){ return -1; } //fprintf(stderr, "Sixel ColorRegs: %d Max_x: %d Max_y: %d\n", ti->color_registers, ti->sixel_maxx, ti->sixel_maxy); + if(ti->color_registers < 64){ // FIXME try to drive it higher + return -1; + } return 0; }