Ignore stray characters in SIXEL data instead of discarding the image. Regression test included.

This commit is contained in:
Michael Grant
2026-10-14 11:43:18 +02:00
parent 4b06bdd63b
commit 7e4dc561ca
2 changed files with 9 additions and 3 deletions

View File

@@ -482,10 +482,8 @@ sixel_parse(const char *buf, size_t len, u_int p1, u_int p2, u_int cell_w,
si->dx = 0; si->dx = 0;
break; break;
default: default:
if (ch < 0x20)
break;
if (ch < 0x3f || ch > 0x7e) if (ch < 0x3f || ch > 0x7e)
goto bad; break;
if (sixel_parse_write(si, ch - 0x3f) != 0) { if (sixel_parse_write(si, ch - 0x3f) != 0) {
log_debug("%s: width limit reached", __func__); log_debug("%s: width limit reached", __func__);
goto bad; goto bad;

View File

@@ -68,6 +68,14 @@ $TMUX new-window -d "
sleep 1 sleep 1
[ "$($TMUX capture-pane -pt:1 -S0 -E0)" = "XY" ] || exit 1 [ "$($TMUX capture-pane -pt:1 -S0 -E0)" = "XY" ] || exit 1
# Stray characters in SIXEL data are ignored, not fatal to the whole image.
$TMUX new-window -d -n sixel-stray "
printf '\033Pq#0;2;100;0;0#0!8~ \$!8~-!8~\033\\\\'
sleep 10"
sleep 1
[ "$($TMUX display-message -pt:sixel-stray '#{cursor_y}')" -gt 0 ] || exit 1
$TMUX kill-window -t:sixel-stray || exit 1
# The protocol default is transmit-only; a later placement uses the retained # The protocol default is transmit-only; a later placement uses the retained
# immutable image and advances by the same canonical one-cell footprint. # immutable image and advances by the same canonical one-cell footprint.
$TMUX new-window -d " $TMUX new-window -d "