Reject oversized keys in Apple decoders

This commit is contained in:
guoling
2026-09-03 17:03:33 +08:00
parent c9f527f489
commit a444b13449
2 changed files with 6 additions and 0 deletions
+3
View File
@@ -43,6 +43,9 @@ NSString *CodedInputDataCrypt::readNSString(KeyValueHolderCrypt &kvHolder) {
auto s_size = static_cast<size_t>(size);
if (s_size <= m_size - m_position) {
if (s_size > mmkv::KeySizeLimit) {
throw length_error("MMKV key too large for uint16 holder");
}
consumeBytes(s_size);
kvHolder.keySize = static_cast<uint16_t>(s_size);