From: Peter Krefting Date: Mon, 01 Jul 2013 07:14:02 GMT Subject: Re: [PATCH 2/2] commit: reject overlong UTF-8 sequences Message-ID: 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/