From 68727b3cfbef3ab4523a3a060538dbab2f734193 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Wed, 4 Jul 2018 14:40:06 -0700 Subject: [PATCH] Fix array end calculation in utf8 assertion --- CHANGELOG.md | 1 + include/boost/beast/websocket/detail/utf8_checker.hpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e6501105..e702e5de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ Version 176: * Tidy up Quick Reference +* Fix array end calculation in utf8 assertion -------------------------------------------------------------------------------- diff --git a/include/boost/beast/websocket/detail/utf8_checker.hpp b/include/boost/beast/websocket/detail/utf8_checker.hpp index 61c241bc..42dbe135 100644 --- a/include/boost/beast/websocket/detail/utf8_checker.hpp +++ b/include/boost/beast/websocket/detail/utf8_checker.hpp @@ -194,7 +194,7 @@ write(std::uint8_t const* in, std::size_t size) // Add characters to the code point while(n--) *p_++ = *in++; - BOOST_ASSERT(p_ <= cp_ + 5); + BOOST_ASSERT(p_ <= cp_ + 4); // Still incomplete? if(need_ > 0) @@ -313,7 +313,7 @@ tail: while(n--) *p_++ = *in++; BOOST_ASSERT(in == end); - BOOST_ASSERT(p_ <= cp_ + 5); + BOOST_ASSERT(p_ <= cp_ + 4); // Do partial validation on the incomplete // code point, this is called "Fail fast"