Re: [PATCH 2/2] commit: reject overlong UTF-8 sequences
- From
Peter Krefting <peter@softwolves.pp.se>
- Date
- Jul 1, 2013, 07:14 UTC
- Message-ID
- <alpine.DEB.2.00.1307010812470.21709@ds9.cixit.se>
- In-Reply-To
- <20130629174140.GC226907@vauxhall.crustytoothpaste.net>
brian m. carlson:
> int offset = 0;
> + static const unsigned int max_codepoint[] = {
> + 0x7f, 0x7ff, 0xffff, 0x1fffff
> + };Since Unicode is not defined beyond U+10FFFF, you can easily make the last range end at U+10FFF. Doing that, ...
> if (codepoint > 0x10ffff) > return bad_offset;
... you can also drop this test, as it will have been tested by the max test already.
-- \\// Peter - http://www.softwolves.pp.se/