mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-05-29 21:38:03 -04:00
sixel: clamp max width/height in 'CSI ? 2 ; 3 ; W ; H S'
This ensures the user cannot raise the maximum sixel size, where width*height cannot be represented as an integer. Note, we should consider moving all sixel width/height variables from int to size_t. But, since it doesn't make any sense with overly large sixel images, clamping the max width/height is enough. Add a static_assert() that checks SIXEL_MAX_WIDTH * SIXEL_MAX_HEIGHT doesn't overflow. Closes #2343
This commit is contained in:
parent
4bf60d0fbc
commit
92187d2e4e
3 changed files with 14 additions and 5 deletions
8
sixel.h
8
sixel.h
|
|
@ -2,10 +2,14 @@
|
|||
|
||||
#include "terminal.h"
|
||||
|
||||
#define SIXEL_MAX_COLORS 1024u
|
||||
#define SIXEL_MAX_WIDTH 10000u
|
||||
#define SIXEL_MAX_COLORS 1024u
|
||||
#define SIXEL_MAX_WIDTH 10000u
|
||||
#define SIXEL_MAX_HEIGHT 10000u
|
||||
|
||||
static_assert(SIXEL_MAX_WIDTH * SIXEL_MAX_HEIGHT ==
|
||||
(size_t)SIXEL_MAX_WIDTH * SIXEL_MAX_HEIGHT,
|
||||
"sixel max size triggers integer overflow");
|
||||
|
||||
typedef void (*sixel_put)(struct terminal *term, uint8_t c);
|
||||
|
||||
void sixel_fini(struct terminal *term);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue