Added a boundary check to the optimization branch of next_validate
git-svn-id: http://svn.code.sf.net/p/utfcpp/code@52 a809a056-fc17-0410-9590-b4f493f8b08e
This commit is contained in:
parent
4e848f2c69
commit
94c65497d9
1 changed files with 8 additions and 4 deletions
|
@ -126,11 +126,15 @@ namespace internal
|
|||
typedef typename std::iterator_traits<octet_iterator>::difference_type octet_difference_type;
|
||||
octet_difference_type sequence_length;
|
||||
if (cp < 0x80) {
|
||||
if (end - it > 0) {
|
||||
if (code_point)
|
||||
*code_point = cp;
|
||||
++it;
|
||||
return OK;
|
||||
}
|
||||
else
|
||||
return NOT_ENOUGH_ROOM;
|
||||
}
|
||||
else if ((cp >> 5) == 0x6)
|
||||
sequence_length = 2;
|
||||
else if ((cp >> 4) == 0xe)
|
||||
|
|
Loading…
Add table
Reference in a new issue