diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2020-11-15 17:06:26 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2020-11-15 17:06:26 -0800 |
commit | f78cd55ccd913855cc5569dfe2a9213e217bc469 (patch) | |
tree | d08c401bd1973d3c02a318f60e3c0018a8fccbfa | |
parent | d45011b8324fecebb4fc79e57491d341dd96e325 (diff) |
ucs2any: avoid segfaults if SLANT property is missing
Test case:
grep -v SLANT ../../misc-misc/5x7.bdf > 5x7-noslant.bdf
ucs2any 5x7-noslant.bdf ../map-ISO8859-1 -d
Before this fix, the above segfaults in strcmp with a NULL slant pointer.
Fixes: 21063_131 from https://cyber-itl.org/2020/10/28/citl-7000-defects.html
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | ucs2any.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -752,9 +752,11 @@ main(int argc, char *argv[]) da_add_int(map, target, ucs); } else { if (!((is_blockgraphics(ucs) && + slant != NULL && strcmp(slant, "R") != 0) || (ucs >= 0x200e && - ucs <= 0x200f))) { + ucs <= 0x200f))) + { fprintf(stderr, "No glyph for character U+%04X (0x%02x) available.\n", ucs, target); @@ -780,8 +782,9 @@ main(int argc, char *argv[]) } if (dec_chars == 1 || - (dec_chars == -1 && strcmp(slant, "R") == 0 && - strcmp(spacing, "C") == 0)) + (dec_chars == -1 && + (slant != NULL && strcmp(slant, "R") == 0) && + (spacing != NULL && strcmp(spacing, "C") == 0))) { /* add DEC VT100 graphics characters in the range 1-31 (as expected by some old xterm versions) */ |