diff --git a/image-sixel.c b/image-sixel.c index 606a5af03..b0d73ff09 100644 --- a/image-sixel.c +++ b/image-sixel.c @@ -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; break; default: - if (ch < 0x20) - break; if (ch < 0x3f || ch > 0x7e) - goto bad; + break; if (sixel_parse_write(si, ch - 0x3f) != 0) { log_debug("%s: width limit reached", __func__); goto bad; diff --git a/regress/image-support.sh b/regress/image-support.sh index 9f6d98dfd..c251b1911 100755 --- a/regress/image-support.sh +++ b/regress/image-support.sh @@ -68,6 +68,14 @@ $TMUX new-window -d " sleep 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 # immutable image and advances by the same canonical one-cell footprint. $TMUX new-window -d "