Merge cherrypicks of [12364563, 12364330, 12364331, 12364332, 12363743, 12364605, 12363956, 12363957, 12363958, 12364309, 12364483, 12364484, 12364564, 12364333, 12364334, 12364335, 12364336, 12364337, 12364607] into rvc-release
Change-Id: Ie9f4226d1f67acd2680aac6e366b4c3b0e30933e
This commit is contained in:
commit
a790490ec9
1 changed files with 7 additions and 1 deletions
|
|
@ -322,8 +322,14 @@ status_t String8::appendFormatV(const char* fmt, va_list args)
|
|||
n = vsnprintf(nullptr, 0, fmt, tmp_args);
|
||||
va_end(tmp_args);
|
||||
|
||||
if (n != 0) {
|
||||
if (n < 0) return UNKNOWN_ERROR;
|
||||
|
||||
if (n > 0) {
|
||||
size_t oldLength = length();
|
||||
if ((size_t)n > SIZE_MAX - 1 ||
|
||||
oldLength > SIZE_MAX - (size_t)n - 1) {
|
||||
return NO_MEMORY;
|
||||
}
|
||||
char* buf = lockBuffer(oldLength + n);
|
||||
if (buf) {
|
||||
vsnprintf(buf + oldLength, n + 1, fmt, args);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue