Restrict a2b_hex to 2000 bytes. am: 9a659e31c1

Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/13805068

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ibdaaf80a067aff3764062ec1f698b68ff9e8e6fa
This commit is contained in:
Rahul Frias
2021-03-09 19:57:33 +00:00
committed by Automerger Merge Worker

View File

@@ -254,6 +254,8 @@ std::vector<uint8_t> Base64SafeDecode(const std::string& b64_input) {
std::string HexEncode(const uint8_t* in_buffer, unsigned int size) {
static const char kHexChars[] = "0123456789ABCDEF";
if (size == 0) return "";
constexpr unsigned int kMaxSafeSize = 2048;
if (size > kMaxSafeSize) size = kMaxSafeSize;
// Each input byte creates two output hex characters.
std::string out_buffer(size * 2, '\0');