deroff: fix out-of-bounds access if runes above 0X80 are inside EQ clauses (thanks mmnmnnmnmm, via plan9port)
Characters greater than 0X80 will cause a read beyond the bounds of the array chars[]. For particular unicode characters this can cause deroff to segfault. A minimal example: $ deroff .EQ u∈ Segmentation fault Throughout deroff, charclass() is used instead of directly indexing chars[] so I presume this was just missed.
This commit is contained in:
parent
6dbecfb457
commit
9e27ee094c
1 changed files with 1 additions and 1 deletions
|
@ -745,7 +745,7 @@ eqn(void)
|
||||||
}
|
}
|
||||||
if(c != '\n')
|
if(c != '\n')
|
||||||
while(C1 != '\n') {
|
while(C1 != '\n') {
|
||||||
if(chars[c] == PUNCT)
|
if(charclass(c) == PUNCT)
|
||||||
last = c;
|
last = c;
|
||||||
else
|
else
|
||||||
if(c != ' ')
|
if(c != ' ')
|
||||||
|
|
Loading…
Reference in a new issue