Skip to content

Commit

Permalink
Handle too-large code points in generated code
Browse files Browse the repository at this point in the history
This is simpler than doing so by hand.
  • Loading branch information
DemiMarie committed Jan 31, 2023
1 parent f6e93a8 commit 039273c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions gentbl.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ def print_interval(interval, last_cat):
print_interval(interval, last_cat)
interval = [i, i]
print_interval(interval, last_cat)
print(' case 0x10FFFF ... UINT32_MAX: // too large')
if __name__ == '__main__':
main()
3 changes: 2 additions & 1 deletion qrexec-lib/unpack.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,11 @@ static int validate_utf8_char(const unsigned char *untrusted_c) {
case 0xE0020 ... 0xE007F: // category Cf
case 0xF0000 ... 0xFFFFD: // category Co
case 0x100000 ... 0x10FFFD: // category Co
case 0x110000 ... UINT32_MAX: // too large
return 0; // Invalid UTF-8 or forbidden codepoint

default:
return code_point > 0x10FFFF ? 0 : total_size;
return total_size;
}
}

Expand Down

0 comments on commit 039273c

Please sign in to comment.