Merge pull request #8 from ghewgill/master

Check for end iterator before using iterator
This commit is contained in:
nemtrif 2016-10-19 09:06:54 -04:00 committed by GitHub
commit a5ad5ec9d9
1 changed files with 3 additions and 0 deletions

View File

@ -222,6 +222,9 @@ namespace internal
template <typename octet_iterator>
utf_error validate_next(octet_iterator& it, octet_iterator end, uint32_t& code_point)
{
if (it == end)
return NOT_ENOUGH_ROOM;
// Save the original value of it so we can go back in case of failure
// Of course, it does not make much sense with i.e. stream iterators
octet_iterator original_it = it;