termptyesc: fix hangs spotted by afl-fuzz + tests

terminology-1.4
Boris Faure 3 years ago
parent 7f1c37a6a7
commit 6c55ecf1a1
  1. 6
      src/bin/termptyesc.c
  2. 37
      tests/hang-invalid-truecolors.sh
  3. 1
      tests/tests.results

@ -607,6 +607,12 @@ _csi_truecolor_arg_get(Termpty *ty, Eina_Unicode **ptr)
*ptr = NULL;
return -CSI_ARG_NO_VALUE;
}
/* invalid values */
if ((*b < '0') || (*b > '9'))
{
*ptr = NULL;
return -CSI_ARG_ERROR;
}
while ((*b >= '0') && (*b <= '9'))
{

@ -0,0 +1,37 @@
#!/bin/sh
# fill space with E
printf '\033#8'
# set color
printf '\033[46;31;3m'
##
# invalid foreground/background truecolors, separated with ':'
##
# RGB
printf '\033[48:2:244:144:25:>m'
printf '\033[38:2:56:150:199:>m'
# CMY
printf '\033[48:3:4:43:90:>m'
printf '\033[38:3:78:41:22:>m'
# CMYK
printf '\033[48:4::0:41:90:4:>m'
printf '\033[38:4::72:25:0:22:>m'
##
# invalid foreground/background truecolors, separated with ':'
##
# RGB
printf '\033[48;2;244;144;25;>m'
printf '\033[38;2;56;150;199;>m'
# CMY
printf '\033[48;3;4;43;90;>m'
printf '\033[38;3;78;41;22;>m'
# CMYK
printf '\033[48;4;0;41;90;4;>m'
printf '\033[38;4;72;25;0;22;>m'

@ -31,6 +31,7 @@ dsr-udk.sh 0d8dd90df01e63af33924cd49e0df945
colors.sh c98080b6ede33b2e7e3b68776cb28132
sgr-leading-trailing-semicolon.sh 079efb55d1a716dc2ad7111e54ec4538
sgr-truecolors.sh 74e7c0e3718818f0e0ab0f9f8caeb894
hang-invalid-truecolors.sh fa5de74f9994d29d17d506fe870f760d
sgr-long.sh 992d1bed20d6479533d328eaa34598e9
decsclm.sh fa5de74f9994d29d17d506fe870f760d
cha.sh 45484618660b9e06c5203a8151797513

Loading…
Cancel
Save