WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
308713
Integer overflow in IndexedDB string key length bypasses bounds check
https://bugs.webkit.org/show_bug.cgi?id=308713
Summary
Integer overflow in IndexedDB string key length bypasses bounds check
Jarred Sumner
Reported
2026-02-26 00:32:05 PST
I found this via Claude Code Security. Please don't credit me personally. SUMMARY In the string key deserialization path of decodeKey() at Source/WebCore/Modules/indexeddb/server/IDBSerialization.cpp:326, the bounds check data.size() < length * 2 uses 32-bit unsigned arithmetic for the multiplication (length is uint32_t). When length >= 0x80000000, length * 2 wraps to a small value, bypassing the check. The subsequent reserveInitialCapacity(length) attempts to allocate ~4GB, causing an OOM crash. DETAILS At IDBSerialization.cpp:321-330: case SIDBKeyType::String: { uint32_t length; if (!readLittleEndian(data, length)) return false; if (data.size() < length * 2) // uint32_t * 2 overflows return false; Vector<char16_t> buffer; buffer.reserveInitialCapacity(length); // tries to reserve ~2GB+ entries For example, length=0x80000000 gives length*2=0 (wrap), so data.size() < 0 is always false, and the check passes. The binary key case (nearby code) correctly uses uint64_t for its size field and has a separate > std::numeric_limits<size_t>::max() check, confirming this string case is missing equivalent protection. SUGGESTED FIX Cast length to size_t before multiplying: if (data.size() < static_cast<size_t>(length) * 2).
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2026-02-26 00:32:11 PST
<
rdar://problem/171245941
>
Anne van Kesteren
Comment 2
2026-03-04 09:31:11 PST
https://github.com/WebKit/WebKit/pull/59885
EWS
Comment 3
2026-03-04 11:31:34 PST
Committed
308649@main
(e5eb16d1eda3): <
https://commits.webkit.org/308649@main
> Reviewed commits have been landed. Closing PR #59885 and removing active labels.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug