1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 09:27:59 +00:00

Avoid undefined left shift in ANSI macro.

If term->esc_query == -1 (reflecting an escape sequence in which the
CSI is followed by a prefix character other than ?) then the ANSI
macro shouldn't shift it left by 8, because that's undefined behaviour
(although in practice I'd be very surprised if any compiler has
actually miscompiled it yet).

Multiplying it by 256 is a safe alternative which has the behaviour I
wanted.
This commit is contained in:
Simon Tatham 2019-02-06 20:52:45 +00:00
parent 5b17a2ce20
commit 85eaaa86b7

View File

@ -169,7 +169,7 @@ struct terminal_tag {
unsigned esc_args[ARGS_MAX];
int esc_nargs;
int esc_query;
#define ANSI(x,y) ((x)+((y)<<8))
#define ANSI(x,y) ((x)+((y)*256))
#define ANSI_QUE(x) ANSI(x,1)
#define OSC_STR_MAX 2048