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: I0222738e2478832fc53012be6b234b34f62935b9
This commit is contained in:
@@ -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) {
|
std::string HexEncode(const uint8_t* in_buffer, unsigned int size) {
|
||||||
static const char kHexChars[] = "0123456789ABCDEF";
|
static const char kHexChars[] = "0123456789ABCDEF";
|
||||||
if (size == 0) return "";
|
if (size == 0) return "";
|
||||||
|
constexpr unsigned int kMaxSafeSize = 2048;
|
||||||
|
if (size > kMaxSafeSize) size = kMaxSafeSize;
|
||||||
// Each input byte creates two output hex characters.
|
// Each input byte creates two output hex characters.
|
||||||
std::string out_buffer(size * 2, '\0');
|
std::string out_buffer(size * 2, '\0');
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user