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,10 +126,14 @@ namespace internal
|
||||||
typedef typename std::iterator_traits<octet_iterator>::difference_type octet_difference_type;
|
typedef typename std::iterator_traits<octet_iterator>::difference_type octet_difference_type;
|
||||||
octet_difference_type sequence_length;
|
octet_difference_type sequence_length;
|
||||||
if (cp < 0x80) {
|
if (cp < 0x80) {
|
||||||
if (code_point)
|
if (end - it > 0) {
|
||||||
*code_point = cp;
|
if (code_point)
|
||||||
++it;
|
*code_point = cp;
|
||||||
return OK;
|
++it;
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return NOT_ENOUGH_ROOM;
|
||||||
}
|
}
|
||||||
else if ((cp >> 5) == 0x6)
|
else if ((cp >> 5) == 0x6)
|
||||||
sequence_length = 2;
|
sequence_length = 2;
|
||||||
|
|
Loading…
Add table
Reference in a new issue