Utf8Codex DecodeTail read past end of buffer
Utf8Codex DecodeTail read past end of buffer

Decoding a Unicode byte-sequence can cause us to read extra bytes past
the end of the source buffer if the sequence is truncated by the end of
buffer immediately after the starting character.

The read characters are unused as the unicode sequence will include a
NULL character and, thus, be considered badly-formed resulting in the
decoded character becoming the unknown character (0xFFFD).

Bug is in DecodeInto, where we always add 4 to the source pointer and
use that as a pointer to the end of the buffer. Because we always add 4,
we always assume there are 4 more characters in the buffer, even when
there are less.

Fix is to calculate the real end of the source buffer and pass that down to DecodeTail which will allow us to avoid reading past the end of the buffer.

Fixes https://microsoft.visualstudio.com/OS/_workitems?id=8989055&_a=edit

Microsoft/ChakraCore,mrkmarron/ChakraCore,mrkmarron/ChakraCore,mrkmarron/ChakraCore,Microsoft/ChakraCore,mrkmarron/ChakraCore,Microsoft/ChakraCore,mrkmarron/ChakraCore,mrkmarron/ChakraCore,Microsoft/ChakraCore,mrkmarron/ChakraCore,Microsoft/ChakraCore,Microsoft/ChakraCore